@likec4/diagram 1.22.0 → 1.23.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 (240) hide show
  1. package/dist/LikeC4Diagram.js +2 -3
  2. package/dist/base/BaseXYFlow.js +0 -1
  3. package/dist/base/example/custom.d.ts +1 -1
  4. package/dist/base/primitives/customEdge.d.ts +1 -1
  5. package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
  6. package/dist/context/DiagramEventHandlers.d.ts +6 -2
  7. package/dist/context/DiagramEventHandlers.js +25 -20
  8. package/dist/context/DiagramFeatures.d.ts +1 -1
  9. package/dist/context/DiagramFeatures.js +9 -22
  10. package/dist/{style.css → diagram.css} +1 -1
  11. package/dist/hooks/index.d.ts +0 -1
  12. package/dist/hooks/safeContext.d.ts +7 -0
  13. package/dist/hooks/safeContext.js +14 -0
  14. package/dist/hooks/useCurrentViewId.js +1 -1
  15. package/dist/hooks/useDiagram.d.ts +7250 -6596
  16. package/dist/hooks/useDiagram.js +29 -14
  17. package/dist/index.js +1 -1
  18. package/dist/likec4diagram/DiagramUI.js +12 -5
  19. package/dist/likec4diagram/XYFlow.js +11 -5
  20. package/dist/likec4diagram/custom/edges/NotePopover.js +1 -2
  21. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +1 -1
  22. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  23. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -7
  24. package/dist/likec4diagram/custom/index.d.ts +1 -1
  25. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
  26. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +1 -2
  27. package/dist/likec4diagram/ui/controls/Controls.js +5 -13
  28. package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -2
  29. package/dist/likec4diagram/ui/controls/ToggleReadonly.d.ts +1 -0
  30. package/dist/likec4diagram/ui/controls/ToggleReadonly.js +28 -0
  31. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +8 -9
  32. package/dist/likec4diagram/ui/notation/NotationPanel.js +1 -2
  33. package/dist/likec4diagram/ui/search/LikeC4Search.js +2 -4
  34. package/dist/likec4diagram/ui/search/ViewsColum.js +1 -1
  35. package/dist/likec4diagram/ui/search/state.js +1 -1
  36. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -2
  37. package/dist/likec4diagram/useViewToNodesEdges.d.ts +0 -1
  38. package/dist/likec4diagram/useViewToNodesEdges.js +0 -2
  39. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Accordion/Accordion.module.css.mjs.vanilla.css.js +1 -0
  40. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.module.css.mjs.vanilla.css.js +1 -0
  41. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Affix/Affix.module.css.mjs.vanilla.css.js +1 -0
  42. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Alert/Alert.module.css.mjs.vanilla.css.js +1 -0
  43. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Anchor/Anchor.module.css.mjs.vanilla.css.js +1 -0
  44. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AngleSlider/AngleSlider.module.css.mjs.vanilla.css.js +1 -0
  45. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AppShell/AppShell.module.css.mjs.vanilla.css.js +1 -0
  46. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/AspectRatio/AspectRatio.module.css.mjs.vanilla.css.js +1 -0
  47. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Avatar/Avatar.module.css.mjs.vanilla.css.js +1 -0
  48. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/BackgroundImage/BackgroundImage.module.css.mjs.vanilla.css.js +1 -0
  49. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Badge/Badge.module.css.mjs.vanilla.css.js +1 -0
  50. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Blockquote/Blockquote.module.css.mjs.vanilla.css.js +1 -0
  51. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Breadcrumbs/Breadcrumbs.module.css.mjs.vanilla.css.js +1 -0
  52. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Burger/Burger.module.css.mjs.vanilla.css.js +1 -0
  53. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Button/Button.module.css.mjs.vanilla.css.js +1 -0
  54. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Card/Card.module.css.mjs.vanilla.css.js +1 -0
  55. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Center/Center.module.css.mjs.vanilla.css.js +1 -0
  56. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/Checkbox.module.css.mjs.vanilla.css.js +1 -0
  57. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/CheckboxCard/CheckboxCard.module.css.mjs.vanilla.css.js +1 -0
  58. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.css.mjs.vanilla.css.js +1 -0
  59. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Chip/Chip.module.css.mjs.vanilla.css.js +1 -0
  60. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/CloseButton/CloseButton.module.css.mjs.vanilla.css.js +1 -0
  61. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Code/Code.module.css.mjs.vanilla.css.js +1 -0
  62. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorInput/ColorInput.module.css.mjs.vanilla.css.js +1 -0
  63. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorPicker/ColorPicker.module.css.mjs.vanilla.css.js +1 -0
  64. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ColorSwatch/ColorSwatch.module.css.mjs.vanilla.css.js +1 -0
  65. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Combobox/Combobox.module.css.mjs.vanilla.css.js +1 -0
  66. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Container/Container.module.css.mjs.vanilla.css.js +1 -0
  67. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Dialog/Dialog.module.css.mjs.vanilla.css.js +1 -0
  68. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Divider/Divider.module.css.mjs.vanilla.css.js +1 -0
  69. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Drawer/Drawer.module.css.mjs.vanilla.css.js +1 -0
  70. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Fieldset/Fieldset.module.css.mjs.vanilla.css.js +1 -0
  71. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Flex/Flex.module.css.mjs.vanilla.css.js +1 -0
  72. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/FloatingIndicator/FloatingIndicator.module.css.mjs.vanilla.css.js +1 -0
  73. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Grid/Grid.module.css.mjs.vanilla.css.js +1 -0
  74. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Group/Group.module.css.mjs.vanilla.css.js +1 -0
  75. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Image/Image.module.css.mjs.vanilla.css.js +1 -0
  76. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Indicator/Indicator.module.css.mjs.vanilla.css.js +1 -0
  77. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/InlineInput/InlineInput.module.css.mjs.vanilla.css.js +1 -0
  78. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Input/Input.module.css.mjs.vanilla.css.js +1 -0
  79. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Kbd/Kbd.module.css.mjs.vanilla.css.js +1 -0
  80. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/List/List.module.css.mjs.vanilla.css.js +1 -0
  81. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Loader/Loader.module.css.mjs.vanilla.css.js +1 -0
  82. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/LoadingOverlay/LoadingOverlay.module.css.mjs.vanilla.css.js +1 -0
  83. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Mark/Mark.module.css.mjs.vanilla.css.js +1 -0
  84. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Menu/Menu.module.css.mjs.vanilla.css.js +1 -0
  85. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Modal/Modal.module.css.mjs.vanilla.css.js +1 -0
  86. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ModalBase/ModalBase.module.css.mjs.vanilla.css.js +1 -0
  87. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/NavLink/NavLink.module.css.mjs.vanilla.css.js +1 -0
  88. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Notification/Notification.module.css.mjs.vanilla.css.js +1 -0
  89. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/NumberInput/NumberInput.module.css.mjs.vanilla.css.js +1 -0
  90. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Overlay/Overlay.module.css.mjs.vanilla.css.js +1 -0
  91. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Pagination/Pagination.module.css.mjs.vanilla.css.js +1 -0
  92. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Paper/Paper.module.css.mjs.vanilla.css.js +1 -0
  93. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PasswordInput/PasswordInput.module.css.mjs.vanilla.css.js +1 -0
  94. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Pill/Pill.module.css.mjs.vanilla.css.js +1 -0
  95. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PillsInput/PillsInput.module.css.mjs.vanilla.css.js +1 -0
  96. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/PinInput/PinInput.module.css.mjs.vanilla.css.js +1 -0
  97. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Popover/Popover.module.css.mjs.vanilla.css.js +1 -0
  98. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Progress/Progress.module.css.mjs.vanilla.css.js +1 -0
  99. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/Radio.module.css.mjs.vanilla.css.js +1 -0
  100. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/RadioCard/RadioCard.module.css.mjs.vanilla.css.js +1 -0
  101. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Radio/RadioIndicator/RadioIndicator.module.css.mjs.vanilla.css.js +1 -0
  102. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Rating/Rating.module.css.mjs.vanilla.css.js +1 -0
  103. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/RingProgress/RingProgress.module.css.mjs.vanilla.css.js +1 -0
  104. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ScrollArea/ScrollArea.module.css.mjs.vanilla.css.js +1 -0
  105. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SegmentedControl/SegmentedControl.module.css.mjs.vanilla.css.js +1 -0
  106. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SemiCircleProgress/SemiCircleProgress.module.css.mjs.vanilla.css.js +1 -0
  107. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/SimpleGrid/SimpleGrid.module.css.mjs.vanilla.css.js +1 -0
  108. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Skeleton/Skeleton.module.css.mjs.vanilla.css.js +1 -0
  109. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Slider/Slider.module.css.mjs.vanilla.css.js +1 -0
  110. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Spoiler/Spoiler.module.css.mjs.vanilla.css.js +1 -0
  111. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Stack/Stack.module.css.mjs.vanilla.css.js +1 -0
  112. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Stepper/Stepper.module.css.mjs.vanilla.css.js +1 -0
  113. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Switch/Switch.module.css.mjs.vanilla.css.js +1 -0
  114. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Table/Table.module.css.mjs.vanilla.css.js +1 -0
  115. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/TableOfContents/TableOfContents.module.css.mjs.vanilla.css.js +1 -0
  116. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tabs/Tabs.module.css.mjs.vanilla.css.js +1 -0
  117. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Text/Text.module.css.mjs.vanilla.css.js +1 -0
  118. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/ThemeIcon/ThemeIcon.module.css.mjs.vanilla.css.js +1 -0
  119. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Timeline/Timeline.module.css.mjs.vanilla.css.js +1 -0
  120. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Title/Title.module.css.mjs.vanilla.css.js +1 -0
  121. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.module.css.mjs.vanilla.css.js +1 -0
  122. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/Tree/Tree.module.css.mjs.vanilla.css.js +1 -0
  123. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/TypographyStylesProvider/TypographyStylesProvider.module.css.mjs.vanilla.css.js +1 -0
  124. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.module.css.mjs.vanilla.css.js +1 -0
  125. package/dist/node_modules/.pnpm/@mantine_core@7.17.0_@mantine_hooks@7.17.0_react@19.0.0__@types_react@19.0.8_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@mantine/core/esm/components/VisuallyHidden/VisuallyHidden.module.css.mjs.vanilla.css.js +1 -0
  126. package/dist/overlays/Overlays.d.ts +4 -1
  127. package/dist/overlays/Overlays.js +72 -60
  128. package/dist/overlays/element-details/ElementDetails.d.ts +6 -0
  129. package/dist/overlays/element-details/ElementDetails.js +31 -0
  130. package/dist/overlays/element-details/ElementDetailsCard.js +4 -9
  131. package/dist/overlays/element-details/TabPanelDeployments.js +1 -1
  132. package/dist/overlays/element-details/TabPanelRelationships.d.ts +3 -4
  133. package/dist/overlays/element-details/TabPanelRelationships.js +20 -20
  134. package/dist/overlays/element-details/actor.d.ts +20626 -0
  135. package/dist/overlays/element-details/actor.js +68 -0
  136. package/dist/overlays/element-details/actorContext.d.ts +7 -0
  137. package/dist/overlays/element-details/actorContext.js +14 -0
  138. package/dist/overlays/overlay/Overlay.css.js +87 -87
  139. package/dist/overlays/overlay/Overlay.js +16 -1
  140. package/dist/overlays/overlaysActor.d.ts +190 -0
  141. package/dist/overlays/overlaysActor.js +233 -0
  142. package/dist/overlays/relationship-details/actor.d.ts +130 -4
  143. package/dist/overlays/relationship-details/actor.js +2 -2
  144. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
  145. package/dist/overlays/relationship-details/custom/nodeTypes.js +17 -0
  146. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +17 -19
  147. package/dist/overlays/relationships-browser/actor.d.ts +1095 -8
  148. package/dist/overlays/relationships-browser/actor.js +181 -173
  149. package/dist/overlays/relationships-browser/custom/ElementActions.js +3 -2
  150. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
  151. package/dist/overlays/relationships-browser/custom/nodeTypes.js +17 -0
  152. package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
  153. package/dist/overlays/relationships-browser/hooks.js +7 -5
  154. package/dist/overlays/types.d.ts +29 -0
  155. package/dist/{likec4diagram/DiagramActor.d.ts → state/DiagramActorProvider.d.ts} +2 -2
  156. package/dist/state/DiagramActorProvider.js +77 -0
  157. package/dist/{likec4diagram/state → state}/assign.d.ts +2 -2
  158. package/dist/{likec4diagram/state → state}/assign.js +2 -2
  159. package/dist/state/diagram-machine.d.ts +11680 -0
  160. package/dist/{likec4diagram/state/machine.js → state/diagram-machine.js} +120 -192
  161. package/dist/{likec4diagram/state → state}/hotkeyActor.d.ts +1 -1
  162. package/dist/state/hotkeyActor.js +26 -0
  163. package/dist/state/inspector.d.ts +4 -0
  164. package/dist/{likec4diagram/state → state}/syncManualLayoutActor.d.ts +7 -8
  165. package/dist/{likec4diagram/state → state}/syncManualLayoutActor.js +7 -13
  166. package/dist/state/types.d.ts +19 -0
  167. package/dist/state/utils.d.ts +17 -0
  168. package/dist/{likec4diagram/state → state}/utils.js +20 -1
  169. package/package.json +20 -25
  170. package/src/LikeC4Diagram.tsx +3 -5
  171. package/src/base/BaseXYFlow.tsx +2 -1
  172. package/src/base/primitives/compound/CompoundTitle.css.ts +0 -5
  173. package/src/context/DiagramEventHandlers.tsx +27 -13
  174. package/src/context/DiagramFeatures.tsx +9 -22
  175. package/src/hooks/index.ts +0 -1
  176. package/src/hooks/safeContext.tsx +16 -0
  177. package/src/hooks/useCurrentViewId.ts +2 -2
  178. package/src/hooks/useDiagram.ts +47 -15
  179. package/src/likec4diagram/DiagramUI.tsx +14 -11
  180. package/src/likec4diagram/XYFlow.tsx +13 -6
  181. package/src/likec4diagram/custom/edges/NotePopover.tsx +1 -2
  182. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  183. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +6 -7
  184. package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +1 -1
  185. package/src/likec4diagram/ui/controls/ChangeAutoLayoutButton.tsx +2 -3
  186. package/src/likec4diagram/ui/controls/Controls.tsx +4 -4
  187. package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -2
  188. package/src/likec4diagram/ui/controls/ToggleReadonly.tsx +30 -0
  189. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +8 -11
  190. package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
  191. package/src/likec4diagram/ui/search/LikeC4Search.tsx +1 -4
  192. package/src/likec4diagram/ui/search/ViewsColum.tsx +1 -1
  193. package/src/likec4diagram/ui/search/state.ts +1 -1
  194. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -2
  195. package/src/likec4diagram/useViewToNodesEdges.ts +0 -4
  196. package/src/overlays/Overlays.tsx +81 -71
  197. package/src/overlays/element-details/ElementDetails.tsx +33 -0
  198. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -18
  199. package/src/overlays/element-details/TabPanelDeployments.tsx +1 -1
  200. package/src/overlays/element-details/TabPanelRelationships.tsx +33 -32
  201. package/src/overlays/element-details/actor.ts +102 -0
  202. package/src/overlays/element-details/actorContext.tsx +16 -0
  203. package/src/overlays/overlay/Overlay.tsx +14 -11
  204. package/src/overlays/overlaysActor.ts +278 -0
  205. package/src/overlays/relationship-details/actor.ts +8 -11
  206. package/src/overlays/relationship-details/custom/nodeTypes.tsx +18 -0
  207. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +23 -29
  208. package/src/overlays/relationships-browser/actor.ts +216 -220
  209. package/src/overlays/relationships-browser/custom/ElementActions.tsx +3 -2
  210. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +20 -0
  211. package/src/overlays/relationships-browser/hooks.ts +7 -5
  212. package/src/overlays/types.ts +39 -0
  213. package/src/state/DiagramActorProvider.tsx +97 -0
  214. package/src/{likec4diagram/state → state}/assign.ts +4 -4
  215. package/src/{likec4diagram/state/machine.ts → state/diagram-machine.ts} +152 -203
  216. package/src/state/hotkeyActor.ts +29 -0
  217. package/src/state/inspector.ts +5 -0
  218. package/src/{likec4diagram/state → state}/syncManualLayoutActor.ts +14 -21
  219. package/src/state/types.ts +23 -0
  220. package/src/{likec4diagram/state → state}/utils.ts +24 -2
  221. package/dist/hooks/useDiagramActor.d.ts +0 -5
  222. package/dist/hooks/useDiagramActor.js +0 -21
  223. package/dist/hooks/useDiagramContext.d.ts +0 -3
  224. package/dist/hooks/useDiagramContext.js +0 -10
  225. package/dist/likec4diagram/DiagramActor.js +0 -71
  226. package/dist/likec4diagram/state/actorContext.d.ts +0 -51923
  227. package/dist/likec4diagram/state/actorContext.js +0 -12
  228. package/dist/likec4diagram/state/hotkeyActor.js +0 -18
  229. package/dist/likec4diagram/state/inspector.d.ts +0 -5
  230. package/dist/likec4diagram/state/machine.d.ts +0 -10979
  231. package/dist/likec4diagram/state/utils.d.ts +0 -8
  232. package/src/hooks/useDiagramActor.ts +0 -27
  233. package/src/hooks/useDiagramContext.ts +0 -14
  234. package/src/likec4diagram/DiagramActor.tsx +0 -79
  235. package/src/likec4diagram/state/actorContext.ts +0 -8
  236. package/src/likec4diagram/state/hotkeyActor.ts +0 -20
  237. package/src/likec4diagram/state/inspector.ts +0 -23
  238. /package/dist/{likec4diagram/state → state}/aligners.d.ts +0 -0
  239. /package/dist/{likec4diagram/state → state}/aligners.js +0 -0
  240. /package/src/{likec4diagram/state → state}/aligners.ts +0 -0
@@ -1,8 +1,12 @@
1
+ import "@likec4/core";
2
+ import { useCallbackRef } from "@mantine/hooks";
3
+ import { useSelector } from "@xstate/react";
4
+ import { shallowEqual } from "fast-equals";
1
5
  import { useTransition, useMemo } from "react";
2
- import { useDiagramActor } from "./useDiagramActor.js";
3
- import { DiagramContext } from "../likec4diagram/state/machine.js";
6
+ import { findDiagramEdge, findDiagramNode } from "../state/utils.js";
7
+ import { useDiagramActorRef } from "./safeContext.js";
4
8
  function useDiagram() {
5
- const actor = useDiagramActor();
9
+ const actor = useDiagramActorRef();
6
10
  const [, startTransition] = useTransition();
7
11
  return useMemo(() => ({
8
12
  send: actor.send,
@@ -43,11 +47,6 @@ function useDiagram() {
43
47
  actor.send({ type: "open.relationshipDetails", edgeId });
44
48
  });
45
49
  },
46
- closeOverlay: () => {
47
- startTransition(() => {
48
- actor.send({ type: "close.overlay" });
49
- });
50
- },
51
50
  updateNodeData: (nodeId, data) => {
52
51
  actor.send({ type: "update.nodeData", nodeId, data });
53
52
  },
@@ -66,7 +65,8 @@ function useDiagram() {
66
65
  * @returns true if there was pending request to save layout
67
66
  */
68
67
  cancelSaveManualLayout: () => {
69
- const syncState = actor.getSnapshot().context.syncLayoutActorRef.getSnapshot().value;
68
+ var _a;
69
+ const syncState = (_a = actor.getSnapshot().children.syncLayout) == null ? void 0 : _a.getSnapshot().value;
70
70
  actor.send({ type: "saveManualLayout.cancel" });
71
71
  return syncState === "pending" || syncState === "paused";
72
72
  },
@@ -82,11 +82,13 @@ function useDiagram() {
82
82
  /**
83
83
  * @warning Do not use in render phase
84
84
  */
85
- currentView: () => actor.getSnapshot().context.view,
85
+ get currentView() {
86
+ return actor.getSnapshot().context.view;
87
+ },
86
88
  /**
87
89
  * @warning Do not use in render phase
88
90
  */
89
- getState: () => actor.getSnapshot(),
91
+ getSnapshot: () => actor.getSnapshot(),
90
92
  /**
91
93
  * @warning Do not use in render phase
92
94
  */
@@ -95,13 +97,13 @@ function useDiagram() {
95
97
  * @warning Do not use in render phase
96
98
  */
97
99
  findDiagramNode: (xynodeId) => {
98
- return DiagramContext.findDiagramNode(actor.getSnapshot().context, xynodeId);
100
+ return findDiagramNode(actor.getSnapshot().context, xynodeId);
99
101
  },
100
102
  /**
101
103
  * @warning Do not use in render phase
102
104
  */
103
105
  findDiagramEdge: (xyedgeId) => {
104
- return DiagramContext.findDiagramEdge(actor.getSnapshot().context, xyedgeId);
106
+ return findDiagramEdge(actor.getSnapshot().context, xyedgeId);
105
107
  },
106
108
  startWalkthrough: () => {
107
109
  actor.send({ type: "walkthrough.start" });
@@ -111,9 +113,22 @@ function useDiagram() {
111
113
  },
112
114
  stopWalkthrough: () => {
113
115
  actor.send({ type: "walkthrough.end" });
116
+ },
117
+ toggleFeature: (feature, forceValue) => {
118
+ actor.send({ type: "toggle.feature", feature, ...forceValue !== void 0 && { forceValue } });
114
119
  }
115
120
  }), [actor]);
116
121
  }
122
+ function useDiagramActorSnapshot(selector, compare = shallowEqual) {
123
+ const actorRef = useDiagramActorRef();
124
+ return useSelector(actorRef, useCallbackRef(selector), compare);
125
+ }
126
+ function useDiagramContext(selector, compare = shallowEqual) {
127
+ return useDiagramActorSnapshot(useCallbackRef((s) => selector(s.context)), compare);
128
+ }
117
129
  export {
118
- useDiagram
130
+ useDiagram,
131
+ useDiagramActorRef,
132
+ useDiagramActorSnapshot,
133
+ useDiagramContext
119
134
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* empty css */
1
+ /* empty css */
2
2
  import { FramerMotionConfig } from "./context/FramerMotionConfig.js";
3
3
  import { LikeC4Diagram } from "./LikeC4Diagram.js";
4
4
  import { Overlay } from "./overlays/overlay/Overlay.js";
@@ -1,17 +1,24 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useDiagramActorSnapshot } from "../hooks/useDiagram.js";
2
3
  import { Overlays } from "../overlays/Overlays.js";
4
+ import { useEnabledFeatures } from "../context/DiagramFeatures.js";
3
5
  import { Controls } from "./ui/controls/Controls.js";
4
- import { IfEnabled } from "../context/DiagramFeatures.js";
5
6
  import { DiagramTitlePanel } from "./ui/diagram-title/DiagramTitlePanel.js";
6
7
  import { NotationPanel } from "./ui/notation/NotationPanel.js";
7
8
  import { DynamicViewWalkthrough } from "./ui/walkthrough/DynamicViewWalkthrough.js";
8
9
  function DiagramUI() {
10
+ const {
11
+ enableViewTitle,
12
+ enableNotations,
13
+ enableDynamicViewWalkthrough
14
+ } = useEnabledFeatures();
15
+ const overlaysActorRef = useDiagramActorSnapshot((s) => s.children.overlays);
9
16
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10
17
  /* @__PURE__ */ jsx(Controls, {}),
11
- /* @__PURE__ */ jsx(Overlays, {}),
12
- /* @__PURE__ */ jsx(IfEnabled, { feature: "ViewTitle", children: /* @__PURE__ */ jsx(DiagramTitlePanel, {}) }),
13
- /* @__PURE__ */ jsx(IfEnabled, { feature: "Notations", children: /* @__PURE__ */ jsx(NotationPanel, {}) }),
14
- /* @__PURE__ */ jsx(IfEnabled, { feature: "DynamicViewWalkthrough", children: /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}) })
18
+ overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
19
+ enableViewTitle && /* @__PURE__ */ jsx(DiagramTitlePanel, {}),
20
+ enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
21
+ enableDynamicViewWalkthrough && /* @__PURE__ */ jsx(DynamicViewWalkthrough, {})
15
22
  ] });
16
23
  }
17
24
  export {
@@ -5,8 +5,7 @@ import clsx from "clsx";
5
5
  import { shallowEqual } from "fast-equals";
6
6
  import { memo } from "react";
7
7
  import { BaseXYFlow } from "../base/BaseXYFlow.js";
8
- import { useDiagram } from "../hooks/useDiagram.js";
9
- import { useDiagramContext } from "../hooks/useDiagramContext.js";
8
+ import { useDiagram, useDiagramContext } from "../hooks/useDiagram.js";
10
9
  import { edgeTypes } from "./custom/index.js";
11
10
  import { DiagramUI } from "./DiagramUI.js";
12
11
  import { useLayoutConstraints } from "./useLayoutConstraints.js";
@@ -20,9 +19,16 @@ const selectXYProps = (ctx) => ({
20
19
  zoomable: ctx.zoomable,
21
20
  fitViewPadding: ctx.fitViewPadding,
22
21
  enableFitView: ctx.features.enableFitView,
23
- enableReadOnly: ctx.features.enableReadOnly
22
+ enableReadOnly: ctx.features.enableReadOnly || ctx.toggledFeatures.enableReadOnly,
23
+ ...!ctx.features.enableFitView && {
24
+ viewport: {
25
+ x: -Math.min(ctx.view.bounds.x, 0),
26
+ y: -Math.min(ctx.view.bounds.y, 0),
27
+ zoom: 1
28
+ }
29
+ }
24
30
  });
25
- const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.fitViewPadding === b.fitViewPadding && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges);
31
+ const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.fitViewPadding === b.fitViewPadding && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges) && shallowEqual(a.viewport, b.viewport);
26
32
  const LikeC4DiagramXYFlow = memo(({ background, nodesDraggable, nodesSelectable }) => {
27
33
  const diagram = useDiagram();
28
34
  const {
@@ -110,7 +116,7 @@ const LikeC4DiagramXYFlow = memo(({ background, nodesDraggable, nodesSelectable
110
116
  ...enableFitView && {
111
117
  onViewportResize
112
118
  },
113
- nodesDraggable,
119
+ nodesDraggable: notReadOnly && nodesDraggable,
114
120
  nodesSelectable,
115
121
  ...notReadOnly && nodesDraggable && layoutConstraints,
116
122
  ...props,
@@ -3,8 +3,7 @@ import { Popover, PopoverTarget, PopoverDropdown, Stack, ScrollAreaAutosize, Tex
3
3
  import { useDebouncedEffect } from "@react-hookz/web";
4
4
  import { useState } from "react";
5
5
  import { isTruthy, isNonNull } from "remeda";
6
- import { useDiagram } from "../../../hooks/useDiagram.js";
7
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
6
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
8
7
  import { edgeNoteText, edgeNoteCloseButton } from "./NotePopover.css.js";
9
8
  import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
10
9
  import { stopPropagation } from "../../../utils/xyflow.js";
@@ -7,9 +7,9 @@ export declare const RelationshipEdge: NamedExoticComponent<{
7
7
  target: string;
8
8
  style?: CSSProperties;
9
9
  id: string;
10
+ selected?: boolean;
10
11
  selectable?: boolean;
11
12
  deletable?: boolean;
12
- selected?: boolean;
13
13
  animated?: boolean;
14
14
  sourceX: number;
15
15
  sourceY: number;
@@ -241,7 +241,7 @@ const RelationshipEdge = customEdge((props) => {
241
241
  let renderLabel;
242
242
  if (!isControlPointDragging) {
243
243
  const notes = props.data.notes;
244
- if (notes && isStepEdgeId(props.id) && ((_a = diagram.getState().context.activeWalkthrough) == null ? void 0 : _a.stepId) === props.id) {
244
+ if (notes && isStepEdgeId(props.id) && ((_a = diagram.getContext().activeWalkthrough) == null ? void 0 : _a.stepId) === props.id) {
245
245
  renderLabel = (props2) => /* @__PURE__ */ jsx(NotePopover, { notes, children: /* @__PURE__ */ jsx("div", { ...props2 }) });
246
246
  } else if (enableRelationshipDetails) {
247
247
  renderLabel = (props2) => /* @__PURE__ */ jsx(
@@ -6,9 +6,8 @@ import clsx from "clsx";
6
6
  import { useCallback, Fragment as Fragment$1, forwardRef } from "react";
7
7
  import { pipe, map, filter, isTruthy, partition } from "remeda";
8
8
  import { Link } from "../../../components/Link.js";
9
- import { useDiagram } from "../../../hooks/useDiagram.js";
10
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
11
- import { DiagramContext } from "../../state/machine.js";
9
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
10
+ import { findDiagramNode, findDiagramEdge } from "../../../state/utils.js";
12
11
  import { menuDropdown, endpoint, title, menuItemRelationship } from "./RelationshipsDropdownMenu.css.js";
13
12
  import { useLikeC4Model } from "../../../likec4model/useLikeC4Model.js";
14
13
  import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
@@ -33,9 +32,9 @@ function RelationshipsDropdownMenu({
33
32
  children
34
33
  }) {
35
34
  const { diagramEdge, sourceNode, targetNode } = useDiagramContext((ctx) => ({
36
- diagramEdge: DiagramContext.findDiagramEdge(ctx, edgeId),
37
- sourceNode: DiagramContext.findDiagramNode(ctx, source),
38
- targetNode: DiagramContext.findDiagramNode(ctx, target)
35
+ diagramEdge: findDiagramEdge(ctx, edgeId),
36
+ sourceNode: findDiagramNode(ctx, source),
37
+ targetNode: findDiagramNode(ctx, target)
39
38
  }));
40
39
  const likec4model = useLikeC4Model(true);
41
40
  const diagram = useDiagram();
@@ -142,7 +141,7 @@ const Relationship = forwardRef(({
142
141
  const diagram = useDiagram();
143
142
  const { enableNavigateTo } = useEnabledFeature("NavigateTo");
144
143
  const { onOpenSource } = useDiagramEventHandlers();
145
- const viewId = diagram.currentView().id;
144
+ const viewId = diagram.currentView.id;
146
145
  const sourceId = getShortId(r, r.source.id, sourceNode);
147
146
  const targetId = getShortId(r, r.target.id, targetNode);
148
147
  const navigateTo = enableNavigateTo && ((_a = r.navigateTo) == null ? void 0 : _a.id) !== viewId ? (_b = r.navigateTo) == null ? void 0 : _b.id : void 0;
@@ -8,9 +8,9 @@ export declare const edgeTypes: {
8
8
  target: string;
9
9
  style?: CSSProperties;
10
10
  id: string;
11
+ selected?: boolean;
11
12
  selectable?: boolean;
12
13
  deletable?: boolean;
13
- selected?: boolean;
14
14
  animated?: boolean;
15
15
  sourceX: number;
16
16
  sourceY: number;
@@ -3,7 +3,7 @@ import { Paper, Stack, Box, Text, Group } from "@mantine/core";
3
3
  import { useDebouncedValue } from "@mantine/hooks";
4
4
  import { NodeToolbar } from "@xyflow/react";
5
5
  import clsx from "clsx";
6
- import { useDiagramContext } from "../../../../hooks/useDiagramContext.js";
6
+ import { useDiagramContext } from "../../../../hooks/useDiagram.js";
7
7
  import { stopPropagation } from "../../../../utils/xyflow.js";
8
8
  import { toolbarTitle } from "./styles.css.js";
9
9
  const useSelectedNodesCount = () => {
@@ -4,8 +4,7 @@ import { useHover, useUncontrolled, clampUseMovePosition, useMove, useMergedRef
4
4
  import { useDebouncedCallback } from "@react-hookz/web";
5
5
  import { IconLayoutDashboard } from "@tabler/icons-react";
6
6
  import { useState, forwardRef } from "react";
7
- import { useDiagram } from "../../../hooks/useDiagram.js";
8
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
7
+ import { useDiagram, useDiagramContext } from "../../../hooks/useDiagram.js";
9
8
  import { Tooltip, ActionIcon } from "./_shared.js";
10
9
  import { autolayoutIndicator, autolayoutButton, spacingSliderBody, spacingSliderThumb } from "./styles.css.js";
11
10
  import { useDiagramEventHandlers } from "../../../context/DiagramEventHandlers.js";
@@ -1,12 +1,10 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Group, Stack, ActionIconGroup, Badge, Loader } from "@mantine/core";
2
+ import { Group, Stack, ActionIconGroup } from "@mantine/core";
3
3
  import { IconMenu2, IconFileSymlink, IconFocusCentered } from "@tabler/icons-react";
4
4
  import { clsx } from "clsx";
5
5
  import { LayoutGroup } from "framer-motion";
6
6
  import { memo } from "react";
7
- import { useDiagram } from "../../../hooks/useDiagram.js";
8
- import { useDiagramSyncLayoutState } from "../../../hooks/useDiagramActor.js";
9
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
7
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
10
8
  import { LikeC4Search } from "../search/LikeC4Search.js";
11
9
  import { ActionIcon, Tooltip } from "./_shared.js";
12
10
  import { ChangeAutoLayoutButton } from "./ChangeAutoLayoutButton.js";
@@ -14,6 +12,7 @@ import { LayoutDriftNotification } from "./LayoutDriftNotification.js";
14
12
  import { ManualLayoutToolsButton } from "./ManualLayoutToolsButton.js";
15
13
  import { NavigationButtons } from "./NavigationButtons.js";
16
14
  import { navigationButtons, actionIconGroup, panel } from "./styles.css.js";
15
+ import { ToggleReadonly } from "./ToggleReadonly.js";
17
16
  import { useDiagramEventHandlers } from "../../../context/DiagramEventHandlers.js";
18
17
  import { useEnabledFeatures } from "../../../context/DiagramFeatures.js";
19
18
  import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
@@ -82,6 +81,7 @@ const Controls = memo(() => {
82
81
  children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.5 })
83
82
  }
84
83
  ) }),
84
+ enableControls && /* @__PURE__ */ jsx(ToggleReadonly, {}),
85
85
  enableControls && hasLayoutDrift && /* @__PURE__ */ jsx(LayoutDriftNotification, { ...portalProps }),
86
86
  enableControls && notReadOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
87
87
  /* @__PURE__ */ jsx(ChangeAutoLayoutButton, { ...portalProps }),
@@ -99,19 +99,11 @@ const Controls = memo(() => {
99
99
  ) })
100
100
  ] })
101
101
  ] }),
102
- /* @__PURE__ */ jsxs(Group, { children: [
103
- enableSearch && /* @__PURE__ */ jsx(LikeC4Search, {}),
104
- notReadOnly && /* @__PURE__ */ jsx(SyncLayoutBadge, {})
105
- ] })
102
+ /* @__PURE__ */ jsx(Group, { children: enableSearch && /* @__PURE__ */ jsx(LikeC4Search, {}) })
106
103
  ]
107
104
  }
108
105
  );
109
106
  });
110
- const SyncLayoutBadge = () => {
111
- const isPending = useDiagramSyncLayoutState((s) => s.hasTag("pending"));
112
- if (!isPending) return null;
113
- return /* @__PURE__ */ jsx(Badge, { color: "pink", radius: "xs", size: "xs", variant: "light", leftSection: /* @__PURE__ */ jsx(Loader, { color: "orange", size: 8 }), children: "Pending..." });
114
- };
115
107
  export {
116
108
  Controls
117
109
  };
@@ -1,8 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
3
3
  import { AnimatePresence, m } from "framer-motion";
4
- import { useDiagram } from "../../../hooks/useDiagram.js";
5
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
4
+ import { useDiagram, useDiagramContext } from "../../../hooks/useDiagram.js";
6
5
  import { ActionIcon } from "./_shared.js";
7
6
  const NavigationButtons = () => {
8
7
  const diagram = useDiagram();
@@ -0,0 +1 @@
1
+ export declare const ToggleReadonly: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,28 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconLock, IconLockOpen2 } from "@tabler/icons-react";
3
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
4
+ import { Tooltip, ActionIcon } from "./_shared.js";
5
+ const selector = (state) => ({
6
+ visible: state.features.enableReadOnly !== true,
7
+ isReadOnly: state.toggledFeatures.enableReadOnly ?? state.features.enableReadOnly
8
+ });
9
+ const ToggleReadonly = () => {
10
+ const { visible, isReadOnly } = useDiagramContext(selector);
11
+ const diagram = useDiagram();
12
+ if (!visible) {
13
+ return null;
14
+ }
15
+ return /* @__PURE__ */ jsx(Tooltip, { label: isReadOnly ? "Enable editing" : "Disable editing", children: /* @__PURE__ */ jsx(
16
+ ActionIcon,
17
+ {
18
+ onClick: (e) => {
19
+ e.stopPropagation();
20
+ diagram.toggleFeature("ReadOnly");
21
+ },
22
+ children: isReadOnly ? /* @__PURE__ */ jsx(IconLock, {}) : /* @__PURE__ */ jsx(IconLockOpen2, {})
23
+ }
24
+ ) });
25
+ };
26
+ export {
27
+ ToggleReadonly
28
+ };
@@ -5,17 +5,16 @@ import { IconMenu } from "@tabler/icons-react";
5
5
  import clsx from "clsx";
6
6
  import { AnimatePresence, m } from "framer-motion";
7
7
  import { Link } from "../../../components/Link.js";
8
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
8
+ import { useDiagramContext } from "../../../hooks/useDiagram.js";
9
9
  import { card, title, description, container } from "./DiagramTitlePanel.css.js";
10
- const selector = (s) => ({
11
- id: s.view.id,
12
- title: s.view.title ?? "untitled",
13
- description: s.view.description,
14
- links: s.view.links,
15
- isNotActiveWalkthrough: s.activeWalkthrough === null
16
- });
17
10
  function DiagramTitlePanel() {
18
- const { id, title: title$1, description: description$1, links, isNotActiveWalkthrough } = useDiagramContext(selector);
11
+ const { id, title: title$1, description: description$1, links, isNotActiveWalkthrough } = useDiagramContext((s) => ({
12
+ id: s.view.id,
13
+ title: s.view.title ?? "untitled",
14
+ description: s.view.description,
15
+ links: s.view.links,
16
+ isNotActiveWalkthrough: s.activeWalkthrough === null
17
+ }));
19
18
  const [isCollapsed, setCollapsed] = useLocalStorage({
20
19
  key: "diagram-title-webview-collapsed",
21
20
  defaultValue: false
@@ -7,8 +7,7 @@ import clsx from "clsx";
7
7
  import { AnimatePresence, m } from "framer-motion";
8
8
  import { memo, useState } from "react";
9
9
  import { ceil, isNonNullish } from "remeda";
10
- import { useDiagram } from "../../../hooks/useDiagram.js";
11
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
10
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
12
11
  import { useXYStore } from "../../../hooks/useXYFlow.js";
13
12
  import { container, card, tabPanel, elementNotation, shapeBadge } from "./NotationPanel.css.js";
14
13
  import { useMantinePortalProps } from "../../../hooks/useMantinePortalProps.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { Portal, RemoveScroll, Group, Box, ActionIcon, Grid, GridCol, Title, ScrollArea, ScrollAreaAutosize, Stack } from "@mantine/core";
3
- import { useDisclosure, useHotkeys, useCallbackRef, useFocusTrap, useFocusWithin, useMergedRef, useWindowEvent, useFocusReturn } from "@mantine/hooks";
3
+ import { useDisclosure, useHotkeys, useCallbackRef, useFocusTrap, useWindowEvent, useFocusReturn } from "@mantine/hooks";
4
4
  import { IconX } from "@tabler/icons-react";
5
5
  import { AnimatePresence, m, LayoutGroup } from "framer-motion";
6
6
  import { useRef } from "react";
@@ -71,9 +71,7 @@ function LikeC4Search() {
71
71
  }
72
72
  function LikeC4SearchOverlay() {
73
73
  const close = useCloseSearch();
74
- const focusTrapRef = useFocusTrap();
75
- const { ref: forcusRef, focused } = useFocusWithin();
76
- const ref = useMergedRef(forcusRef, focusTrapRef);
74
+ const ref = useFocusTrap();
77
75
  useWindowEvent(
78
76
  "keydown",
79
77
  (event) => {
@@ -5,12 +5,12 @@ import { IconStack2, IconZoomScan } from "@tabler/icons-react";
5
5
  import clsx from "clsx";
6
6
  import { m } from "framer-motion";
7
7
  import { first } from "remeda";
8
+ import { useCurrentViewId } from "../../../hooks/useCurrentViewId.js";
8
9
  import { useLikeC4Model } from "../../../likec4model/useLikeC4Model.js";
9
10
  import { emptyBoX } from "./_shared.css.js";
10
11
  import { useNormalizedSearch, useCloseSearchAndNavigateTo } from "./state.js";
11
12
  import { moveFocusToSearchInput, centerY } from "./utils.js";
12
13
  import { viewTitle, viewDescription, focusable, viewButton } from "./ViewsColumn.css.js";
13
- import { useCurrentViewId } from "../../../hooks/useCurrentViewId.js";
14
14
  const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, children: "Nothing found" });
15
15
  function ViewsColumn() {
16
16
  const search = useNormalizedSearch();
@@ -50,7 +50,7 @@ function useCloseSearchAndNavigateTo() {
50
50
  fromElementFqn ?? (fromElementFqn = (_a = $pickView.get()) == null ? void 0 : _a.elementFqn);
51
51
  setPickView(null);
52
52
  const fromNode = fromElementFqn ? (_b = diagram.getContext().view.nodes.find((n) => DiagramNode.modelRef(n) === fromElementFqn)) == null ? void 0 : _b.id : void 0;
53
- if (diagram.currentView().id === viewId && fromNode) {
53
+ if (diagram.currentView.id === viewId && fromNode) {
54
54
  diagram.focusNode(fromNode);
55
55
  return;
56
56
  }
@@ -4,8 +4,7 @@ import { IconPlayerPlayFilled, IconPlayerSkipBackFilled, IconPlayerStopFilled, I
4
4
  import clsx from "clsx";
5
5
  import { AnimatePresence, m } from "framer-motion";
6
6
  import { isTruthy, isNonNull } from "remeda";
7
- import { useDiagram } from "../../../hooks/useDiagram.js";
8
- import { useDiagramContext } from "../../../hooks/useDiagramContext.js";
7
+ import { useDiagramContext, useDiagram } from "../../../hooks/useDiagram.js";
9
8
  import { parallelStateFrame, btn, buttons, container } from "./DynamicViewWalkthrough.css.js";
10
9
  import { useXYStore } from "../../../hooks/useXYFlow.js";
11
10
  function DynamicViewWalkthrough() {
@@ -3,7 +3,6 @@ import { Types } from './types';
3
3
  export declare function useViewToNodesEdges({ view: { id, nodes, edges, __, }, ...opts }: {
4
4
  view: DiagramView;
5
5
  where: WhereOperator<string, string> | undefined;
6
- nodesDraggable: boolean;
7
6
  nodesSelectable: boolean;
8
7
  }): {
9
8
  xynodes: Types.Node[];
@@ -6,7 +6,6 @@ function viewToNodesEdge(opts) {
6
6
  var _a;
7
7
  const {
8
8
  view,
9
- nodesDraggable: draggable,
10
9
  nodesSelectable: selectable
11
10
  } = opts;
12
11
  view.__ === "dynamic";
@@ -56,7 +55,6 @@ function viewToNodesEdge(opts) {
56
55
  const id = ns + node.id;
57
56
  const base = {
58
57
  id,
59
- draggable,
60
58
  selectable: selectable && node.kind !== ElementKind.Group,
61
59
  focusable: selectable && !isCompound,
62
60
  deletable: false,