@likec4/diagram 1.35.0 → 1.36.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 (214) hide show
  1. package/bundle/{chunk-C0Eg81Gj.js → chunk-7MPUJFHj.js} +315 -311
  2. package/bundle/custom.js +52 -52
  3. package/bundle/index.js +1583 -739
  4. package/dist/LikeC4Diagram.js +6 -6
  5. package/dist/LikeC4Diagram.props.d.ts +2 -3
  6. package/dist/LikeC4ModelProvider.d.ts +3 -3
  7. package/dist/LikeC4ProjectsProvider.d.ts +17 -0
  8. package/dist/LikeC4ProjectsProvider.js +22 -0
  9. package/dist/LikeC4Styles.d.ts +1 -0
  10. package/dist/LikeC4Styles.js +94 -0
  11. package/dist/StaticLikeC4Diagram.d.ts +3 -3
  12. package/dist/base/BaseXYFlow.js +23 -26
  13. package/dist/base/primitives/MarkdownBlock.d.ts +7 -1
  14. package/dist/base/primitives/MarkdownBlock.js +1 -1
  15. package/dist/base/primitives/compound/CompoundActionButton.js +2 -2
  16. package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -2
  17. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
  18. package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -4
  19. package/dist/base/primitives/compound/CompoundTitle.js +9 -8
  20. package/dist/base/primitives/compound/actionbtns.css.js +6 -6
  21. package/dist/base/primitives/edge/EdgeActionButton.js +2 -2
  22. package/dist/base/primitives/edge/EdgeContainer.js +4 -7
  23. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -22
  24. package/dist/base/primitives/edge/EdgeLabel.css.js +6 -84
  25. package/dist/base/primitives/edge/EdgeLabel.js +16 -6
  26. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -6
  27. package/dist/base/primitives/edge/EdgeMarkers.js +3 -3
  28. package/dist/base/primitives/edge/edge.css.d.ts +0 -2
  29. package/dist/base/primitives/edge/edge.css.js +1 -55
  30. package/dist/base/primitives/element/ElementActionButtons.js +2 -2
  31. package/dist/base/primitives/element/ElementDetailsButton.js +8 -7
  32. package/dist/base/primitives/element/ElementNodeContainer.css.js +4 -4
  33. package/dist/base/primitives/element/ElementNodeContainer.js +1 -4
  34. package/dist/base/primitives/element/ElementShape.css.js +11 -11
  35. package/dist/base/primitives/element/ElementTags.d.ts +1 -0
  36. package/dist/base/primitives/element/ElementTags.js +17 -14
  37. package/dist/bundle/LikeC4View.d.ts +1 -1
  38. package/dist/bundle/LikeC4View.js +7 -1
  39. package/dist/bundle/LikeC4View.props.d.ts +1 -2
  40. package/dist/bundle/ReactLikeC4.d.ts +1 -1
  41. package/dist/bundle/ViewNotFound.js +1 -1
  42. package/dist/bundle/index.d.ts +2 -1
  43. package/dist/bundle/index.js +1 -0
  44. package/dist/bundle/styles.css.js +1 -1
  45. package/dist/components/ErrorFallback.js +1 -1
  46. package/dist/components/GithubIcon.d.ts +2 -0
  47. package/dist/components/GithubIcon.js +17 -0
  48. package/dist/components/Link.d.ts +4 -3
  49. package/dist/components/Link.js +84 -87
  50. package/dist/components/NavigationLink.d.ts +2 -2
  51. package/dist/components/SearchControl.css.js +6 -5
  52. package/dist/context/DiagramEventHandlers.d.ts +6 -6
  53. package/dist/context/DiagramEventHandlers.js +4 -7
  54. package/dist/globals.css.js +3 -0
  55. package/dist/hooks/useXYFlow.d.ts +10 -10
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/likec4diagram/custom/edges/NotePopover.css.js +2 -2
  59. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
  60. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +1 -1
  61. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.js +7 -7
  62. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -3
  63. package/dist/likec4diagram/custom/edges/edges.css.js +4 -4
  64. package/dist/likec4diagram/custom/index.d.ts +2 -2
  65. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +2 -2
  66. package/dist/likec4diagram/ui/controls/styles.css.js +5 -5
  67. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +11 -11
  68. package/dist/likec4diagram/ui/notation/NotationPanel.js +2 -5
  69. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.js +10 -10
  70. package/dist/likec4model/LikeC4ProjectsContext.d.ts +7 -0
  71. package/dist/likec4model/LikeC4ProjectsContext.js +5 -0
  72. package/dist/likec4model/index.d.ts +1 -0
  73. package/dist/likec4model/useLikeC4Project.d.ts +22 -0
  74. package/dist/likec4model/useLikeC4Project.js +23 -0
  75. package/dist/navigationpanel/NavigationPanel.js +15 -17
  76. package/dist/navigationpanel/NavigationPanelControls.js +34 -21
  77. package/dist/navigationpanel/NavigationPanelDropdown.js +33 -17
  78. package/dist/navigationpanel/_common.js +4 -1
  79. package/dist/navigationpanel/actor.d.ts +11 -15
  80. package/dist/navigationpanel/actor.js +14 -15
  81. package/dist/navigationpanel/controls/BurgerButton.js +5 -7
  82. package/dist/navigationpanel/controls/NavigationButtons.js +37 -24
  83. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  84. package/dist/navigationpanel/controls/SearchControl.js +6 -4
  85. package/dist/navigationpanel/controls/ToggleReadonly.js +3 -3
  86. package/dist/navigationpanel/controls/ViewDetailsCard.d.ts +2 -0
  87. package/dist/navigationpanel/controls/ViewDetailsCard.js +232 -0
  88. package/dist/navigationpanel/controls/index.d.ts +1 -0
  89. package/dist/navigationpanel/dropdown/ProjectsMenu.d.ts +2 -0
  90. package/dist/navigationpanel/dropdown/ProjectsMenu.js +75 -0
  91. package/dist/navigationpanel/editorpanel/EditorPanel.js +3 -3
  92. package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -20
  93. package/dist/navigationpanel/editorpanel/styles.js +5 -5
  94. package/dist/navigationpanel/hooks.d.ts +2 -2
  95. package/dist/navigationpanel/styles.css.js +0 -2
  96. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +12 -7
  97. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.js +14 -0
  98. package/dist/node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconLink.js +14 -0
  99. package/dist/overlays/element-details/ElementDetailsCard.css.js +18 -17
  100. package/dist/overlays/element-details/ElementDetailsCard.js +8 -13
  101. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -4
  102. package/dist/overlays/element-details/TabPanelRelationships.css.js +7 -7
  103. package/dist/overlays/overlay/Overlay.css.d.ts +3 -3
  104. package/dist/overlays/overlay/Overlay.css.js +8 -7
  105. package/dist/overlays/relationship-details/SelectEdge.css.js +8 -8
  106. package/dist/overlays/relationships-browser/SelectElement.css.js +1 -1
  107. package/dist/search/Search.js +6 -6
  108. package/dist/search/components/ElementsColumn.css.js +5 -5
  109. package/dist/search/components/SearchByTags.js +3 -2
  110. package/dist/search/components/ViewsColum.js +1 -1
  111. package/dist/search/components/ViewsColumn.css.js +1 -1
  112. package/dist/search/components/_shared.css.js +3 -3
  113. package/dist/search/components/styles.css.js +5 -5
  114. package/dist/state/DiagramActorProvider.js +34 -15
  115. package/dist/state/diagram-machine.d.ts +29 -247
  116. package/dist/state/diagram-machine.js +16 -16
  117. package/dist/styles-min.css +1 -1
  118. package/dist/styles.css +1 -1
  119. package/dist/styles.css2.js +1 -1
  120. package/package.json +10 -8
  121. package/panda.buildinfo.json +254 -326
  122. package/src/LikeC4Diagram.props.ts +2 -2
  123. package/src/LikeC4Diagram.tsx +2 -2
  124. package/src/LikeC4ModelProvider.tsx +4 -4
  125. package/src/LikeC4ProjectsProvider.tsx +41 -0
  126. package/src/LikeC4Styles.tsx +107 -0
  127. package/src/StaticLikeC4Diagram.tsx +3 -3
  128. package/src/base/BaseXYFlow.tsx +24 -29
  129. package/src/base/primitives/MarkdownBlock.tsx +11 -3
  130. package/src/base/primitives/compound/CompoundActionButton.tsx +2 -2
  131. package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -2
  132. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +4 -13
  133. package/src/base/primitives/compound/CompoundNodeContainer.tsx +0 -3
  134. package/src/base/primitives/compound/CompoundTitle.tsx +8 -8
  135. package/src/base/primitives/compound/actionbtns.css.ts +6 -6
  136. package/src/base/primitives/edge/EdgeActionButton.tsx +2 -2
  137. package/src/base/primitives/edge/EdgeContainer.tsx +3 -6
  138. package/src/base/primitives/edge/EdgeLabel.css.ts +4 -83
  139. package/src/base/primitives/edge/EdgeLabel.tsx +16 -10
  140. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -6
  141. package/src/base/primitives/edge/EdgeMarkers.tsx +3 -3
  142. package/src/base/primitives/edge/edge.css.ts +0 -60
  143. package/src/base/primitives/element/ElementActionButtons.tsx +2 -2
  144. package/src/base/primitives/element/ElementDetailsButton.tsx +7 -7
  145. package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -4
  146. package/src/base/primitives/element/ElementNodeContainer.tsx +0 -3
  147. package/src/base/primitives/element/ElementShape.css.ts +11 -11
  148. package/src/base/primitives/element/ElementTags.tsx +17 -14
  149. package/src/bundle/LikeC4View.props.ts +1 -2
  150. package/src/bundle/LikeC4View.tsx +10 -3
  151. package/src/bundle/ReactLikeC4.tsx +1 -2
  152. package/src/bundle/ViewNotFound.tsx +1 -1
  153. package/src/bundle/index.ts +2 -1
  154. package/src/bundle/styles.css.ts +1 -1
  155. package/src/components/ErrorFallback.tsx +1 -1
  156. package/src/components/GithubIcon.tsx +16 -0
  157. package/src/components/Link.tsx +102 -113
  158. package/src/components/NavigationLink.tsx +2 -1
  159. package/src/components/SearchControl.css.ts +5 -5
  160. package/src/context/DiagramEventHandlers.tsx +12 -12
  161. package/src/globals.css +71 -0
  162. package/src/index.ts +5 -0
  163. package/src/likec4diagram/custom/edges/NotePopover.css.ts +2 -2
  164. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  165. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +7 -7
  166. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -3
  167. package/src/likec4diagram/custom/edges/edges.css.ts +4 -4
  168. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +2 -2
  169. package/src/likec4diagram/ui/controls/styles.css.ts +5 -5
  170. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +11 -11
  171. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -4
  172. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.css.ts +10 -10
  173. package/src/likec4model/LikeC4ProjectsContext.ts +9 -0
  174. package/src/likec4model/index.ts +8 -0
  175. package/src/likec4model/useLikeC4Project.ts +61 -0
  176. package/src/navigationpanel/NavigationPanel.tsx +16 -17
  177. package/src/navigationpanel/NavigationPanelControls.tsx +24 -46
  178. package/src/navigationpanel/NavigationPanelDropdown.tsx +32 -16
  179. package/src/navigationpanel/_common.tsx +4 -1
  180. package/src/navigationpanel/actor.ts +14 -15
  181. package/src/navigationpanel/controls/BurgerButton.tsx +5 -7
  182. package/src/navigationpanel/controls/NavigationButtons.tsx +9 -1
  183. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  184. package/src/navigationpanel/controls/SearchControl.tsx +6 -4
  185. package/src/navigationpanel/controls/ToggleReadonly.tsx +3 -3
  186. package/src/navigationpanel/controls/ViewDetailsCard.tsx +244 -0
  187. package/src/navigationpanel/controls/index.ts +1 -0
  188. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +74 -0
  189. package/src/navigationpanel/editorpanel/EditorPanel.tsx +3 -3
  190. package/src/navigationpanel/editorpanel/ManualLayoutToolsButton.tsx +19 -22
  191. package/src/navigationpanel/editorpanel/styles.ts +5 -5
  192. package/src/navigationpanel/hooks.tsx +2 -2
  193. package/src/navigationpanel/styles.css.ts +0 -2
  194. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +9 -4
  195. package/src/overlays/element-details/ElementDetailsCard.css.ts +17 -17
  196. package/src/overlays/element-details/ElementDetailsCard.tsx +8 -13
  197. package/src/overlays/element-details/TabPanelDeployments.css.ts +4 -4
  198. package/src/overlays/element-details/TabPanelRelationships.css.ts +7 -7
  199. package/src/overlays/overlay/Overlay.css.ts +7 -7
  200. package/src/overlays/relationship-details/SelectEdge.css.ts +8 -8
  201. package/src/overlays/relationships-browser/SelectElement.css.ts +1 -1
  202. package/src/search/Search.tsx +6 -6
  203. package/src/search/components/ElementsColumn.css.ts +5 -5
  204. package/src/search/components/SearchByTags.tsx +2 -2
  205. package/src/search/components/ViewsColum.tsx +1 -1
  206. package/src/search/components/ViewsColumn.css.ts +1 -1
  207. package/src/search/components/_shared.css.ts +3 -3
  208. package/src/search/components/styles.css.ts +5 -5
  209. package/src/state/DiagramActorProvider.tsx +45 -20
  210. package/src/state/diagram-machine.ts +22 -16
  211. package/dist/LikeC4CustomColors.d.ts +0 -2
  212. package/dist/LikeC4CustomColors.js +0 -45
  213. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +0 -45
  214. package/src/LikeC4CustomColors.tsx +0 -85
@@ -3,8 +3,8 @@ import { ReactFlowProvider } from '@xyflow/react';
3
3
  import { useRef } from 'react';
4
4
  import { ControlsCustomLayoutProvider } from './context/ControlsCustomLayout.js';
5
5
  import { ReduceGraphicsContext } from './context/ReduceGraphics.js';
6
- import { LikeC4CustomColors } from './LikeC4CustomColors.js';
7
6
  import { LikeC4DiagramXYFlow } from './likec4diagram/DiagramXYFlow.js';
7
+ import { LikeC4Styles } from './LikeC4Styles.js';
8
8
  import { DiagramActorProvider } from './state/DiagramActorProvider.js';
9
9
  import { EnsureMantine } from './context/EnsureMantine.js';
10
10
  import { FramerMotionConfig } from './context/FramerMotionConfig.js';
@@ -108,9 +108,9 @@ function LikeC4Diagram({
108
108
  onOpenSource,
109
109
  onBurgerMenuClick
110
110
  },
111
- children: /* @__PURE__ */ jsx(ReduceGraphicsContext, { reduceGraphics: isReducedGraphicsMode, children: /* @__PURE__ */ jsxs(RootContainer, { className, reduceGraphics: isReducedGraphicsMode, children: [
112
- /* @__PURE__ */ jsx(LikeC4CustomColors, {}),
113
- /* @__PURE__ */ jsx(
111
+ children: /* @__PURE__ */ jsxs(ReduceGraphicsContext, { reduceGraphics: isReducedGraphicsMode, children: [
112
+ /* @__PURE__ */ jsx(LikeC4Styles, {}),
113
+ /* @__PURE__ */ jsx(RootContainer, { className, reduceGraphics: isReducedGraphicsMode, children: /* @__PURE__ */ jsx(
114
114
  ReactFlowProvider,
115
115
  {
116
116
  fitView,
@@ -138,8 +138,8 @@ function LikeC4Diagram({
138
138
  }
139
139
  )
140
140
  }
141
- )
142
- ] }) })
141
+ ) })
142
+ ] })
143
143
  }
144
144
  )
145
145
  }
@@ -1,10 +1,9 @@
1
- import { Any, DiagramEdge, DiagramNode, LayoutedView, ViewChange, WhereOperator } from '@likec4/core/types';
1
+ import { Any, aux, DiagramEdge, DiagramNode, LayoutedView, ViewChange, WhereOperator } from '@likec4/core/types';
2
2
  import { ReactFlowProps as XYFlowProps } from '@xyflow/react';
3
3
  import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
4
4
  import { SetRequired } from 'type-fest';
5
5
  import { ControlsCustomLayout } from './context/ControlsCustomLayout';
6
6
  import { CustomNodes } from './custom/customNodes';
7
- import type * as aux from '@likec4/core/types/_aux';
8
7
  export type { CustomNodes, WhereOperator };
9
8
  export type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, 'navigateTo'>;
10
9
  type ElementIconRendererProps = {
@@ -233,7 +232,7 @@ export type OpenSourceParams<A extends aux.Any = aux.Any> = {
233
232
  } | {
234
233
  view: aux.StrictViewId<A>;
235
234
  };
236
- export interface LikeC4DiagramEventHandlers<A extends aux.Any> {
235
+ export interface LikeC4DiagramEventHandlers<A extends aux.Any = aux.Any> {
237
236
  onChange?: OnChange | null | undefined;
238
237
  onNavigateTo?: OnNavigateTo<A> | null | undefined;
239
238
  onNodeClick?: OnNodeClick<A> | null | undefined;
@@ -1,10 +1,10 @@
1
1
  import { LikeC4Model } from '@likec4/core/model';
2
2
  import { aux } from '@likec4/core/types';
3
3
  import { PropsWithChildren } from 'react';
4
- export type LikeC4ModelProviderProps<A extends aux.Any = aux.Unknown> = PropsWithChildren<{
4
+ export interface LikeC4ModelProviderProps<A extends aux.Any = aux.Unknown> {
5
5
  likec4model: LikeC4Model<A>;
6
- }>;
6
+ }
7
7
  /**
8
8
  * Ensures LikeC4Model context
9
9
  */
10
- export declare function LikeC4ModelProvider<A extends aux.Any = aux.Unknown>({ children, likec4model, }: LikeC4ModelProviderProps<A>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function LikeC4ModelProvider<A extends aux.Any = aux.Unknown>({ children, likec4model, }: PropsWithChildren<LikeC4ModelProviderProps<A>>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { LikeC4Project, ProjectId } from '@likec4/core/types';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface LikeC4ProjectsProviderProps {
4
+ /**
5
+ * Projects to be used in the navigation panel.
6
+ * Current project is taken from the LikeC4Model
7
+ */
8
+ projects: ReadonlyArray<LikeC4Project>;
9
+ /**
10
+ * Optional callback when another project is selected.
11
+ */
12
+ onProjectChange?: (id: ProjectId) => void;
13
+ }
14
+ /**
15
+ * Ensures LikeC4Projects context
16
+ */
17
+ export declare function LikeC4ProjectsProvider({ children, projects, onProjectChange: _onProjectChange, }: PropsWithChildren<LikeC4ProjectsProviderProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useCallbackRef } from '@mantine/hooks';
3
+ import { useCustomCompareMemo } from '@react-hookz/web';
4
+ import { shallowEqual } from 'fast-equals';
5
+ import { useContext } from 'react';
6
+ import { LikeC4ProjectsContext } from './likec4model/LikeC4ProjectsContext.js';
7
+
8
+ function LikeC4ProjectsProvider({
9
+ children,
10
+ projects,
11
+ onProjectChange: _onProjectChange
12
+ }) {
13
+ const outerScope = useContext(LikeC4ProjectsContext);
14
+ if (outerScope) {
15
+ console.warn("LikeC4ProjectsProvider should not be nested inside another one");
16
+ }
17
+ const onProjectChange = useCallbackRef(_onProjectChange);
18
+ const value = useCustomCompareMemo(() => ({ projects, onProjectChange }), [projects, onProjectChange], shallowEqual);
19
+ return /* @__PURE__ */ jsx(LikeC4ProjectsContext.Provider, { value, children });
20
+ }
21
+
22
+ export { LikeC4ProjectsProvider };
@@ -0,0 +1 @@
1
+ export declare function LikeC4Styles(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,94 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { ThemeColors, defaultTheme } from '@likec4/core';
3
+ import { useMantineStyleNonce } from '@mantine/core';
4
+ import { toRgba, mix, toHex, scale } from 'khroma';
5
+ import { pipe, entries, map, join, range } from 'remeda';
6
+ import globalsCss from './globals.css.js';
7
+ import { useLikeC4Specification } from './likec4model/useLikeC4Model.js';
8
+
9
+ const scheme = (scheme2) => `[data-mantine-color-scheme="${scheme2}"]`;
10
+ const whenDark = scheme("dark");
11
+ const whenLight = scheme("light");
12
+ const MAX_DEPTH = 5;
13
+ const generateCompoundColors = (name, colors, depth) => {
14
+ const compoundDarkColor = (color) => toHex(
15
+ scale(color, {
16
+ l: -22 - 5 * depth,
17
+ s: -10 - 6 * depth
18
+ })
19
+ );
20
+ const compoundLightColor = (color) => toHex(
21
+ scale(color, {
22
+ l: -20 - 3 * depth,
23
+ s: -3 - 6 * depth
24
+ })
25
+ );
26
+ const selector = `:where([data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
27
+ return `
28
+ ${selector} {
29
+ --likec4-palette-fill: ${compoundLightColor(colors.elements.fill)};
30
+ --likec4-palette-stroke: ${compoundLightColor(colors.elements.stroke)};
31
+ }
32
+ ${whenDark} ${selector} {
33
+ --likec4-palette-fill: ${compoundDarkColor(colors.elements.fill)};
34
+ --likec4-palette-stroke: ${compoundDarkColor(colors.elements.stroke)};
35
+ }
36
+ `.trim();
37
+ };
38
+ function toStyle(name, colors) {
39
+ const selector = `:where([data-likec4-color=${name}])`;
40
+ return [
41
+ `
42
+ ${selector} {
43
+ --likec4-palette-fill: ${colors.elements.fill};
44
+ --likec4-palette-stroke: ${colors.elements.stroke};
45
+ --likec4-palette-hiContrast: ${colors.elements.hiContrast};
46
+ --likec4-palette-loContrast: ${colors.elements.loContrast};
47
+ --likec4-palette-relation-stroke: ${colors.relationships.lineColor};
48
+ --likec4-palette-relation-label: ${colors.relationships.labelColor};
49
+ --likec4-palette-relation-label-bg: ${colors.relationships.labelBgColor};
50
+ }
51
+ ${whenLight} ${selector} {
52
+ --likec4-palette-relation-stroke-selected: ${toRgba(mix(colors.relationships.lineColor, "black", 85))};
53
+ }
54
+ ${whenDark} ${selector} {
55
+ --likec4-palette-relation-stroke-selected: ${toRgba(mix(colors.relationships.lineColor, "white", 70))};
56
+ }
57
+
58
+ `.trim(),
59
+ ...range(1, MAX_DEPTH + 1).map((depth) => generateCompoundColors(name, colors, depth))
60
+ ].join("\n");
61
+ }
62
+ const builtInColors = ThemeColors.map(
63
+ (color) => toStyle(color, {
64
+ elements: defaultTheme.elements[color],
65
+ relationships: defaultTheme.relationships[color]
66
+ })
67
+ ).join("\n");
68
+ function generateCustomColorStyles(customColors) {
69
+ return pipe(
70
+ entries(customColors),
71
+ map(([name, color]) => toStyle(name, color)),
72
+ join("\n")
73
+ );
74
+ }
75
+ function LikeC4Styles() {
76
+ const nonce = useMantineStyleNonce()?.();
77
+ const customColors = useLikeC4Specification().customColors;
78
+ const customColorsStyles = customColors ? generateCustomColorStyles(customColors) : "";
79
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
80
+ /* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-global": true, dangerouslySetInnerHTML: { __html: globalsCss }, nonce }),
81
+ /* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-colors": true, dangerouslySetInnerHTML: { __html: builtInColors }, nonce }),
82
+ customColorsStyles && /* @__PURE__ */ jsx(
83
+ "style",
84
+ {
85
+ type: "text/css",
86
+ "data-likec4-custom-colors": true,
87
+ dangerouslySetInnerHTML: { __html: customColorsStyles },
88
+ nonce
89
+ }
90
+ )
91
+ ] });
92
+ }
93
+
94
+ export { LikeC4Styles };
@@ -1,4 +1,4 @@
1
+ import { Any, UnknownLayouted } from '@likec4/core/types';
1
2
  import { LikeC4DiagramProperties } from './LikeC4Diagram.props';
2
- import type * as aux from '@likec4/core/types/_aux';
3
- export type StaticLikeC4DiagramProps<A extends aux.Any> = Pick<LikeC4DiagramProperties<A>, 'view' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'enableElementTags' | 'reduceGraphics' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'renderNodes' | 'where'>;
4
- export declare function StaticLikeC4Diagram<A extends aux.Any = aux.UnknownLayouted>({ view, fitView, fitViewPadding, enableRelationshipDetails, enableRelationshipBrowser, background, ...rest }: StaticLikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
3
+ export type StaticLikeC4DiagramProps<A extends Any> = Pick<LikeC4DiagramProperties<A>, 'view' | 'className' | 'fitView' | 'fitViewPadding' | 'background' | 'enableElementDetails' | 'enableRelationshipDetails' | 'enableRelationshipBrowser' | 'enableElementTags' | 'reduceGraphics' | 'initialWidth' | 'initialHeight' | 'renderIcon' | 'renderNodes' | 'where'>;
4
+ export declare function StaticLikeC4Diagram<A extends Any = UnknownLayouted>({ view, fitView, fitViewPadding, enableRelationshipDetails, enableRelationshipBrowser, background, ...rest }: StaticLikeC4DiagramProps<A>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { cx, css } from '@likec4/styles/css';
2
+ import { cx, cva } from '@likec4/styles/css';
3
3
  import { useCallbackRef } from '@mantine/hooks';
4
4
  import { ReactFlow, useStore } from '@xyflow/react';
5
5
  import { Fragment } from 'react';
@@ -10,30 +10,26 @@ import { Background } from './Background.js';
10
10
  import { MinZoom, MaxZoom } from './const.js';
11
11
  import { setHovered } from './types.Base.js';
12
12
 
13
- const cssTransparentBg = css({
14
- background: "transparent !important",
15
- ["--xy-background-color"]: "transparent !important"
16
- });
17
- const cssReactFlow = css({
18
- // '@supports': {
19
- // // https://wojtek.im/journal/targeting-safari-with-css-media-query
20
- // '(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none)': {
21
- // // TODO: this workaround disables animations in Safari (to improve performance)
22
- // vars: {
23
- // [vars.safariAnimationHook]: '',
24
- // },
25
- // },
26
- // },
27
- ["--xy-background-color"]: "{colors.mantine.colors.body}",
28
- ["--xy-background-pattern-color"]: {
29
- _dark: "{colors.mantine.colors.dark[5]}",
30
- _light: "{colors.mantine.colors.gray[4]}"
31
- },
32
- "& .react-flow__pane": {
33
- WebkitUserSelect: "none"
13
+ const cssReactFlow = cva({
14
+ base: {
15
+ "& .react-flow__pane": {
16
+ WebkitUserSelect: "none"
17
+ },
18
+ "& .react-flow__attribution": {
19
+ display: "none"
20
+ }
34
21
  },
35
- "& .react-flow__attribution": {
36
- display: "none"
22
+ variants: {
23
+ transparent: {
24
+ true: {
25
+ background: "transparent !important",
26
+ ["--xy-background-color"]: "transparent !important"
27
+ },
28
+ false: {
29
+ ["--xy-background-color"]: "{colors.likec4.background}",
30
+ ["--xy-background-pattern-color"]: "{colors.likec4.background.pattern}"
31
+ }
32
+ }
37
33
  }
38
34
  });
39
35
  const BaseXYFlow = ({
@@ -66,8 +62,9 @@ const BaseXYFlow = ({
66
62
  nodes,
67
63
  edges,
68
64
  className: cx(
69
- cssReactFlow,
70
- background === "transparent" && cssTransparentBg,
65
+ cssReactFlow({
66
+ transparent: background === "transparent"
67
+ }),
71
68
  className
72
69
  ),
73
70
  ...isZoomTooSmall && {
@@ -1,5 +1,6 @@
1
1
  import { RichTextOrEmpty as RichTextType } from '@likec4/core/types';
2
2
  import { BoxProps } from '@likec4/styles/jsx';
3
+ import { JsxStyleProps } from '@likec4/styles/types';
3
4
  import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
5
  export type MarkdownBlockProps = Omit<BoxProps, 'dangerouslySetInnerHTML' | 'children'> & {
5
6
  value: RichTextType;
@@ -9,10 +10,15 @@ export type MarkdownBlockProps = Omit<BoxProps, 'dangerouslySetInnerHTML' | 'chi
9
10
  */
10
11
  uselikec4palette?: boolean;
11
12
  /**
12
- * Scale factor for the font size.
13
+ * Scale factor for the block
13
14
  * @default 1
14
15
  */
15
16
  textScale?: number;
17
+ /**
18
+ * Font size for the block
19
+ * @default 'md'
20
+ */
21
+ fontSize?: JsxStyleProps['fontSize'];
16
22
  /**
17
23
  * If true, the component will not render anything if the value is empty.
18
24
  * @default false
@@ -17,7 +17,7 @@ const MarkdownBlock = forwardRef(({
17
17
  if (value.isEmpty && hideIfEmpty) {
18
18
  return null;
19
19
  }
20
- const content = value.nonEmpty ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", children: emptyText }) };
20
+ const content = value.nonEmpty ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", style: { userSelect: "none" }, children: emptyText }) };
21
21
  return /* @__PURE__ */ jsx(
22
22
  Box,
23
23
  {
@@ -24,8 +24,8 @@ function CompoundActionButton({
24
24
  className: cx(
25
25
  css({
26
26
  position: "absolute",
27
- top: "5px",
28
- left: "4px",
27
+ top: "[5px]",
28
+ left: "[4px]",
29
29
  _smallZoom: {
30
30
  display: "none"
31
31
  }
@@ -24,8 +24,8 @@ function CompoundDetailsButton({
24
24
  className: cx(
25
25
  css({
26
26
  position: "absolute",
27
- top: "[2px]",
28
- right: "[2px]",
27
+ top: "0.5",
28
+ right: "0.5",
29
29
  _smallZoom: {
30
30
  display: "none"
31
31
  }
@@ -33,7 +33,7 @@ const root = css.raw({
33
33
  width: "100%",
34
34
  height: "100%",
35
35
  border: "transparent",
36
- background: "likec4.palette.fill",
36
+ background: "var(--likec4-palette-fill)",
37
37
  backgroundClip: "padding-box",
38
38
  transitionDelay: ".075ms"
39
39
  },
@@ -70,7 +70,7 @@ const compoundBorder = css.raw({
70
70
  background: "transparent",
71
71
  borderStyle: "dashed",
72
72
  borderWidth: `[${borderWidth.ref}]`,
73
- borderColor: `[color-mix(in srgb, {colors.likec4.palette.stroke} ${borderOpacityPercent.ref}, transparent)]`
73
+ borderColor: `[color-mix(in srgb, var(--likec4-palette-stroke) ${borderOpacityPercent.ref}, transparent)]`
74
74
  });
75
75
  const indicatorSvg = css.raw({
76
76
  position: "absolute",
@@ -92,12 +92,12 @@ const indicatorSvg = css.raw({
92
92
  }
93
93
  });
94
94
  const indicatorRect = css.raw({
95
- stroke: `[color-mix(in srgb, {colors.likec4.palette.stroke} 60%, {colors.likec4.palette.hiContrast})]`,
95
+ stroke: `[color-mix(in srgb, var(--likec4-palette-stroke) 60%, var(--likec4-palette-hiContrast))]`,
96
96
  strokeWidth: "4",
97
97
  fill: "[none]",
98
98
  animationStyle: "indicator",
99
99
  _light: {
100
- stroke: `[color-mix(in srgb, {colors.likec4.palette.stroke} 80%, {colors.likec4.palette.hiContrast})]`
100
+ stroke: `[color-mix(in srgb, var(--likec4-palette-stroke) 80%, var(--likec4-palette-hiContrast))]`
101
101
  }
102
102
  });
103
103
  const compound = sva({
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { cx, css } from '@likec4/styles/css';
2
+ import { cx } from '@likec4/styles/css';
3
3
  import { m } from 'motion/react';
4
4
  import { isNumber, clamp } from 'remeda';
5
5
  import { compound, borderOpacityPercent, borderRadius, borderWidth, compoundOpacity } from './CompoundNodeContainer.css.js';
@@ -44,9 +44,6 @@ function CompoundNodeContainer({
44
44
  m.div,
45
45
  {
46
46
  className: cx(
47
- css({
48
- likec4Palette: `${data.color}.${depth}`
49
- }),
50
47
  classes.root,
51
48
  "likec4-compound-node",
52
49
  className
@@ -8,10 +8,11 @@ const titleContainer = css({
8
8
  position: "absolute",
9
9
  display: "flex",
10
10
  alignItems: "center",
11
- gap: "6px",
12
- left: "14px",
13
- top: "4px",
14
- right: "30px",
11
+ gap: "1.5",
12
+ // 6px
13
+ left: "[14px]",
14
+ top: "[4px]",
15
+ right: "[30px]",
15
16
  width: "auto",
16
17
  minHeight: "30px",
17
18
  [`:where(.react-flow__node.draggable) &`]: {
@@ -19,7 +20,7 @@ const titleContainer = css({
19
20
  cursor: "grab"
20
21
  },
21
22
  [`.likec4-compound-node:has(.compound-action) &`]: {
22
- paddingLeft: "22px"
23
+ paddingLeft: "[22px]"
23
24
  }
24
25
  });
25
26
  const titleText = css({
@@ -29,11 +30,11 @@ const titleText = css({
29
30
  fontSize: "15px",
30
31
  textTransform: "uppercase",
31
32
  letterSpacing: "0.2px",
32
- color: "likec4.palette.loContrast",
33
+ color: "var(--likec4-palette-loContrast)",
33
34
  "[data-compound-title-inverse] &": {
34
35
  color: {
35
- base: "[color-mix(in srgb, {colors.likec4.palette.loContrast} 60%, {colors.likec4.palette.fill})]",
36
- _light: "likec4.palette.stroke"
36
+ base: "[color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))]",
37
+ _light: "var(--likec4-palette-stroke)"
37
38
  }
38
39
  }
39
40
  });
@@ -5,14 +5,14 @@ const compoundActionBtn = cva({
5
5
  transitionDuration: "normal",
6
6
  "[data-compound-title-inverse] &": {
7
7
  _dark: {
8
- "--actionbtn-color": "color-mix(in srgb, {colors.likec4.palette.loContrast} 60%, {colors.likec4.palette.fill})"
8
+ "--actionbtn-color": "color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))"
9
9
  },
10
10
  _light: {
11
- "--actionbtn-color": "{colors.likec4.palette.stroke}",
12
- "--actionbtn-color-hovered": "{colors.likec4.palette.stroke}",
13
- "--actionbtn-color-hovered-btn": "{colors.likec4.palette.hiContrast}",
14
- "--actionbtn-bg-hovered": `{colors.likec4.palette.fill/50}`,
15
- "--actionbtn-bg-hovered-btn": `{colors.likec4.palette.fill}`
11
+ "--actionbtn-color": "var(--likec4-palette-stroke)",
12
+ "--actionbtn-color-hovered": "var(--likec4-palette-stroke)",
13
+ "--actionbtn-color-hovered-btn": "var(--likec4-palette-hiContrast)",
14
+ "--actionbtn-bg-hovered": `var(--likec4-palette-fill)/50`,
15
+ "--actionbtn-bg-hovered-btn": `var(--likec4-palette-fill)`
16
16
  }
17
17
  }
18
18
  },
@@ -1,15 +1,15 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { cx } from '@likec4/styles/css';
3
+ import { edgeActionBtn } from '@likec4/styles/recipes';
3
4
  import { ActionIcon } from '@mantine/core';
4
5
  import { stopPropagation } from '../../../utils/xyflow.js';
5
- import { actionBtn } from './edge.css.js';
6
6
  import IconZoomScan from '../../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconZoomScan.js';
7
7
 
8
8
  function EdgeActionButton({ icon, onClick }) {
9
9
  return /* @__PURE__ */ jsx(
10
10
  ActionIcon,
11
11
  {
12
- className: cx("nodrag nopan", actionBtn),
12
+ className: cx("nodrag nopan", edgeActionBtn()),
13
13
  onPointerDownCapture: stopPropagation,
14
14
  onClick,
15
15
  role: "button",
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { invariant } from '@likec4/core';
3
- import { cx, css } from '@likec4/styles/css';
4
- import { edgeVars, edgeContainer } from './edge.css.js';
3
+ import { cx } from '@likec4/styles/css';
4
+ import { edgeContainer } from './edge.css.js';
5
5
 
6
6
  function EdgeContainer({
7
7
  className,
@@ -18,12 +18,9 @@ function EdgeContainer({
18
18
  }) {
19
19
  const props = {
20
20
  className: cx(
21
- css({
22
- likec4RelationPalette: color
23
- }),
24
- edgeVars,
21
+ className,
25
22
  edgeContainer,
26
- className
23
+ "likec4-edge-container"
27
24
  ),
28
25
  "data-likec4-color": color,
29
26
  "data-edge-dir": data.dir ?? "forward",
@@ -1,4 +1,3 @@
1
- import { SlotRecipeRuntimeFn } from '@likec4/styles/types';
2
1
  export declare const edgeNoteCloseButton: string;
3
2
  export declare const edgeNoteText: string;
4
3
  export declare const translate: {
@@ -6,24 +5,3 @@ export declare const translate: {
6
5
  readonly ref: "var(--edge-translate)";
7
6
  };
8
7
  export declare const edgeLabelContainer: string;
9
- export declare const labelsva: SlotRecipeRuntimeFn<"root" | "stepNumber" | "labelContents" | "labelText" | "labelTechnology", {
10
- isStepEdge: {
11
- false: {};
12
- true: {
13
- root: {
14
- flexDirection: "row";
15
- gap: "4px";
16
- padding: "0px";
17
- };
18
- labelContents: {
19
- display: "flex";
20
- flexDirection: "column";
21
- alignItems: "center";
22
- padding: "2px 5px 4px 0px";
23
- };
24
- labelText: {
25
- padding: "2px 6px 4px 0px";
26
- };
27
- };
28
- };
29
- }>;
@@ -1,10 +1,10 @@
1
- import { css, sva } from '@likec4/styles/css';
1
+ import { css } from '@likec4/styles/css';
2
2
 
3
3
  const labelBorderRadius = "4px";
4
4
  css({
5
5
  position: "absolute",
6
- top: 4,
7
- right: 4
6
+ top: "1",
7
+ right: "1"
8
8
  });
9
9
  css({
10
10
  userSelect: "all",
@@ -22,8 +22,8 @@ const translate = {
22
22
  ref: `var(--edge-translate)`
23
23
  };
24
24
  const edgeLabelContainer = css({
25
- top: 0,
26
- left: 0,
25
+ top: "0",
26
+ left: "0",
27
27
  position: "absolute",
28
28
  pointerEvents: "all",
29
29
  cursor: "pointer",
@@ -53,83 +53,5 @@ const edgeLabelContainer = css({
53
53
  display: "none"
54
54
  }
55
55
  });
56
- const labelsva = sva({
57
- slots: ["root", "stepNumber", "labelContents", "labelText", "labelTechnology"],
58
- base: {
59
- root: {
60
- pointerEvents: "all",
61
- fontFamily: "likec4.relation",
62
- padding: "3px 5px 5px 5px",
63
- display: "flex",
64
- flexDirection: "column",
65
- alignItems: "center",
66
- width: "max-content",
67
- maxWidth: "100%",
68
- gap: "4px"
69
- },
70
- stepNumber: {
71
- alignSelf: "stretch",
72
- flex: "0 0 auto",
73
- fontWeight: 600,
74
- fontSize: "14px",
75
- lineHeight: "1",
76
- padding: "5px 5px",
77
- textAlign: "center",
78
- minWidth: "22px",
79
- borderTopLeftRadius: labelBorderRadius,
80
- borderBottomLeftRadius: labelBorderRadius,
81
- background: `[color-mix(in srgb, {colors.likec4.relation.label.bg}, {colors.likec4.mixColor} 10%)]`,
82
- fontVariantNumeric: "tabular-nums",
83
- // _dark: {
84
- [':where([data-likec4-color="gray"]) &']: {
85
- _dark: {
86
- background: `[color-mix(in srgb, {colors.likec4.relation.label.bg}, {colors.likec4.mixColor} 15%)]`
87
- }
88
- }
89
- },
90
- labelContents: {
91
- display: "contents",
92
- _empty: {
93
- display: "none !important"
94
- }
95
- },
96
- labelText: {
97
- whiteSpaceCollapse: "preserve-breaks",
98
- fontSize: "14px",
99
- lineHeight: "1.185"
100
- },
101
- labelTechnology: {
102
- textAlign: "center",
103
- whiteSpaceCollapse: "preserve-breaks",
104
- fontSize: "11px",
105
- lineHeight: "1",
106
- opacity: 0.75
107
- }
108
- },
109
- variants: {
110
- isStepEdge: {
111
- false: {},
112
- true: {
113
- root: {
114
- flexDirection: "row",
115
- gap: "4px",
116
- padding: "0px"
117
- },
118
- labelContents: {
119
- display: "flex",
120
- flexDirection: "column",
121
- alignItems: "center",
122
- padding: "2px 5px 4px 0px"
123
- },
124
- labelText: {
125
- padding: "2px 6px 4px 0px"
126
- }
127
- }
128
- }
129
- },
130
- defaultVariants: {
131
- isStepEdge: false
132
- }
133
- });
134
56
 
135
- export { edgeLabelContainer, labelsva, translate };
57
+ export { edgeLabelContainer, translate };