@likec4/diagram 1.49.0 → 1.51.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.
@@ -83,7 +83,7 @@ const OArrow = (props) => /* @__PURE__ */ jsx(
83
83
  {
84
84
  d: "M 0 0 L 8 3 L 0 6 L 1 3 z",
85
85
  stroke: "context-stroke",
86
- fill: "context-stroke",
86
+ fill: "var(--likec4-background-color)",
87
87
  strokeWidth: 1.25,
88
88
  strokeLinejoin: "miter",
89
89
  strokeLinecap: "square"
@@ -129,7 +129,7 @@ const ODiamond = (props) => /* @__PURE__ */ jsx(
129
129
  {
130
130
  d: "M5,0 L10,4 L5,8 L0,4 Z",
131
131
  stroke: "context-stroke",
132
- fill: "context-stroke",
132
+ fill: "var(--likec4-background-color)",
133
133
  strokeWidth: 1.25,
134
134
  strokeLinecap: "round"
135
135
  }
@@ -171,7 +171,7 @@ const ODot = (props) => /* @__PURE__ */ jsx(
171
171
  {
172
172
  strokeWidth: 1.25,
173
173
  stroke: "context-stroke",
174
- fill: "context-stroke",
174
+ fill: "var(--likec4-background-color)",
175
175
  cx: 4,
176
176
  cy: 4,
177
177
  r: 3
@@ -12,7 +12,7 @@ type ElementShapeProps = {
12
12
  /**
13
13
  * @default true
14
14
  */
15
- showSeletionOutline?: boolean | undefined;
15
+ showSelectionOutline?: boolean | undefined;
16
16
  };
17
- export declare function ElementShape({ data, width, height, showSeletionOutline }: ElementShapeProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function ElementShape({ data, width, height, showSelectionOutline }: ElementShapeProps): import("react/jsx-runtime").JSX.Element;
18
18
  export {};
@@ -310,7 +310,7 @@ function ShapeSvgOutline({ shape, w, h }) {
310
310
  }
311
311
  return /* @__PURE__ */ jsx("g", { className: "likec4-shape-outline", children: svg });
312
312
  }
313
- function ElementShape({ data, width, height, showSeletionOutline = true }) {
313
+ function ElementShape({ data, width, height, showSelectionOutline = true }) {
314
314
  let w = !!width && width > 10 ? width : data.width;
315
315
  let h = !!height && height > 10 ? height : data.height;
316
316
  const isMultiple = data.style?.multiple ?? false;
@@ -326,7 +326,7 @@ function ElementShape({ data, width, height, showSeletionOutline = true }) {
326
326
  className: elementShapeRecipe({
327
327
  shapetype: "html",
328
328
  withBorder,
329
- withOutline: showSeletionOutline
329
+ withOutline: showSelectionOutline
330
330
  }),
331
331
  children: [
332
332
  isMultiple && /* @__PURE__ */ jsx("div", { className: "likec4-shape-multiple" }),
@@ -337,7 +337,7 @@ function ElementShape({ data, width, height, showSeletionOutline = true }) {
337
337
  }
338
338
  const className = elementShapeRecipe({
339
339
  shapetype: "svg",
340
- withOutline: showSeletionOutline
340
+ withOutline: showSelectionOutline
341
341
  });
342
342
  return /* @__PURE__ */ jsxs(Fragment, { children: [
343
343
  isMultiple && /* @__PURE__ */ jsx("svg", { className, "data-likec4-shape-multiple": "true", viewBox: `0 0 ${w} ${h}`, children: /* @__PURE__ */ jsx(ShapeSvg, { shape: data.shape, size: data.style?.size, w, h }) }),
@@ -22,7 +22,7 @@ const machine = setup({
22
22
  },
23
23
  delays: {
24
24
  "500ms": 500,
25
- "waitBeforeSync": 2e3
25
+ "waitBeforeSync": 1e3
26
26
  },
27
27
  actors: {
28
28
  applyLatest,
@@ -1,2 +1,2 @@
1
1
  import { MemoExoticComponent } from 'react';
2
- export declare const NotationPanel: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ export declare const NotationPanel: MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { cx } from '@likec4/styles/css';
3
- import { Tooltip, ThemeIcon, ActionIcon, Paper, Tabs, TabsList, TabsTab, TabsPanel, ScrollAreaAutosize, Stack, Card, Group, Box, Badge, Text } from '@mantine/core';
3
+ import { Tooltip, ActionIcon, Paper, Tabs, TabsList, TabsTab, TabsPanel, ScrollAreaAutosize, Stack, Card, Group, Box, Badge, Text } from '@mantine/core';
4
4
  import { useLocalStorage } from '@mantine/hooks';
5
5
  import { AnimatePresence, m } from 'motion/react';
6
6
  import { memo, useState } from 'react';
@@ -9,7 +9,6 @@ import { useDiagramContext } from '../../../hooks/useDiagram.js';
9
9
  import { useXYStore } from '../../../hooks/useXYFlow.js';
10
10
  import { container, icon, card, tabPanel, shapeBadge, elementNotation } from './NotationPanel.css.js';
11
11
  import { useMantinePortalProps } from '../../../hooks/useMantinePortalProps.js';
12
- import IconAlertTriangle from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.js';
13
12
  import IconHelpCircle from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconHelpCircle.js';
14
13
  import IconArrowDownRight from '../../../node_modules/.pnpm/@tabler_icons-react@3.36.1_react@19.2.4/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowDownRight.js';
15
14
  import { useDiagram } from '../../../hooks/safeContext.js';
@@ -127,31 +126,9 @@ const NotationPanel = memo(() => {
127
126
  });
128
127
  const hasNotations = notations.length > 0;
129
128
  const portalProps = useMantinePortalProps();
129
+ if (!hasNotations) return null;
130
130
  return /* @__PURE__ */ jsxs(AnimatePresence, { children: [
131
- !hasNotations && /* @__PURE__ */ jsx(
132
- m.div,
133
- {
134
- initial: { opacity: 0.75, translateX: "50%" },
135
- animate: { opacity: 1, translateX: 0 },
136
- exit: {
137
- translateX: "100%",
138
- opacity: 0.6
139
- },
140
- className: container,
141
- children: /* @__PURE__ */ jsx(Tooltip, { label: "View has no notations", color: "orange", ...portalProps, children: /* @__PURE__ */ jsx(
142
- ThemeIcon,
143
- {
144
- size: "lg",
145
- variant: "light",
146
- color: "orange",
147
- radius: "md",
148
- children: /* @__PURE__ */ jsx(IconAlertTriangle, {})
149
- }
150
- ) })
151
- },
152
- "empty"
153
- ),
154
- hasNotations && isCollapsed && /* @__PURE__ */ jsx(
131
+ isCollapsed && /* @__PURE__ */ jsx(
155
132
  m.div,
156
133
  {
157
134
  initial: { opacity: 0.75, translateX: "50%" },
@@ -175,7 +152,7 @@ const NotationPanel = memo(() => {
175
152
  },
176
153
  "collapsed"
177
154
  ),
178
- hasNotations && !isCollapsed && /* @__PURE__ */ jsx(
155
+ !isCollapsed && /* @__PURE__ */ jsx(
179
156
  m.div,
180
157
  {
181
158
  initial: {
@@ -101,7 +101,7 @@ function DriftsSummary() {
101
101
  if (view.length === 0 && nodes.length === 0 && edges.length === 0) {
102
102
  return null;
103
103
  }
104
- return /* @__PURE__ */ jsx(AnimatePresence, { propagate: true, mode: "wait", children: /* @__PURE__ */ jsxs(
104
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs(
105
105
  m.div,
106
106
  {
107
107
  layout: "size",
@@ -120,16 +120,16 @@ function DriftsSummary() {
120
120
  }),
121
121
  children: [
122
122
  hasAtLeast(view, 1) && /* @__PURE__ */ jsx(ViewDrifts, { drifts: view }),
123
- nodes.length > 0 && /* @__PURE__ */ jsxs(m.div, { layout: "size", children: [
123
+ nodes.length > 0 && /* @__PURE__ */ jsxs(m.div, { layout: true, children: [
124
124
  /* @__PURE__ */ jsx(SectionHeader, { children: "Elements:" }),
125
- /* @__PURE__ */ jsx(m.div, { layout: "size", className: vstack({ mt: "2", gap: "2" }), children: map(
125
+ /* @__PURE__ */ jsx("div", { className: vstack({ mt: "2", gap: "2" }), children: map(
126
126
  nodes,
127
127
  (node) => /* @__PURE__ */ jsx(NodeDrifts, { ...node, ...handlers }, node.id)
128
128
  ) })
129
129
  ] }, `nodes-drifts`),
130
- edges.length > 0 && /* @__PURE__ */ jsxs(m.div, { layout: "size", children: [
130
+ edges.length > 0 && /* @__PURE__ */ jsxs(m.div, { layout: true, children: [
131
131
  /* @__PURE__ */ jsx(SectionHeader, { children: "Relationships:" }),
132
- /* @__PURE__ */ jsx(m.div, { layout: "size", className: vstack({ mt: "2", gap: "2" }), children: map(edges, (edge) => /* @__PURE__ */ jsx(EdgeDrifts, { ...edge, ...handlers }, edge.edgeId)) })
132
+ /* @__PURE__ */ jsx("div", { className: vstack({ mt: "2", gap: "2" }), children: map(edges, (edge) => /* @__PURE__ */ jsx(EdgeDrifts, { ...edge, ...handlers }, edge.edgeId)) })
133
133
  ] }, `edges-drifts`)
134
134
  ]
135
135
  },
@@ -153,6 +153,7 @@ function ViewDrifts({ drifts }) {
153
153
  ) });
154
154
  }
155
155
  function NodeDrifts({ id, name, drifts, ...handlers }) {
156
+ const key = `node-drifts-${id}`;
156
157
  return /* @__PURE__ */ jsxs(
157
158
  DriftsGroup,
158
159
  {
@@ -178,28 +179,29 @@ function NodeDrifts({ id, name, drifts, ...handlers }) {
178
179
  children: name
179
180
  }
180
181
  ),
181
- map(drifts, (drift) => /* @__PURE__ */ jsx(DriftLabel, { children: drift }, id + drift))
182
+ map(drifts, (drift, i) => /* @__PURE__ */ jsx(DriftLabel, { children: drift }, key + drift + i))
182
183
  ]
183
184
  },
184
- `node-drifts-${id}`
185
+ key
185
186
  );
186
187
  }
187
188
  function EdgeDrifts({ edgeId, drifts, ...handlers }) {
189
+ const key = `edge-drifts-${edgeId}`;
188
190
  return /* @__PURE__ */ jsx(
189
191
  DriftsGroup,
190
192
  {
191
193
  "data-drift-type": "edge",
192
194
  "data-drift-id": edgeId,
193
195
  ...handlers,
194
- children: map(drifts, (drift) => /* @__PURE__ */ jsx(
196
+ children: map(drifts, (drift, i) => /* @__PURE__ */ jsx(
195
197
  DriftLabel,
196
198
  {
197
199
  children: drift
198
200
  },
199
- edgeId + drift
201
+ key + drift + i
200
202
  ))
201
203
  },
202
- `edge-drifts-${edgeId}`
204
+ key
203
205
  );
204
206
  }
205
207
  const DriftsGroup = styled(m.div, {
@@ -220,7 +222,7 @@ const DriftsGroup = styled(m.div, {
220
222
  defaultProps: {
221
223
  className: "group",
222
224
  variants,
223
- layout: "size",
225
+ layout: true,
224
226
  initial: "initial",
225
227
  animate: "animate",
226
228
  exit: "exit"
@@ -32,14 +32,14 @@ const TriggerWalkthroughButton = forwardRef((props, ref) => /* @__PURE__ */ jsx(
32
32
  }
33
33
  ));
34
34
  function StartWalkthroughButton() {
35
- const { enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
35
+ const { enableCompareWithLatest } = useEnabledFeatures();
36
36
  const diagram = useDiagram();
37
37
  const actor = useNavigationActor();
38
38
  let tooltipLabel = "Start Dynamic View Walkthrough";
39
39
  switch (true) {
40
- case !enableReadOnly:
41
- tooltipLabel = "Walkthrough not available in Edit mode";
42
- break;
40
+ // case !enableReadOnly:
41
+ // tooltipLabel = 'Walkthrough not available in Edit mode'
42
+ // break
43
43
  case enableCompareWithLatest:
44
44
  tooltipLabel = "Walkthrough not available when Compare is active";
45
45
  break;
@@ -57,7 +57,7 @@ function StartWalkthroughButton() {
57
57
  exit: { opacity: 0, translateX: -20 },
58
58
  size: "compact-xs",
59
59
  h: 26,
60
- disabled: !enableReadOnly || enableCompareWithLatest,
60
+ disabled: enableCompareWithLatest,
61
61
  classNames: {
62
62
  label: css({
63
63
  display: {
@@ -90,7 +90,7 @@ function ElementDetailsCard({
90
90
  const isCompound = (nodeModel?.$node.children?.length ?? 0) > 0;
91
91
  const _width = Math.min(700, windowWidth - MIN_PADDING * 2);
92
92
  const _height = Math.min(650, windowHeight - MIN_PADDING * 2);
93
- const fromPositon = rectFromNode ? {
93
+ const fromPosition = rectFromNode ? {
94
94
  x: rectFromNode.x + (isCompound ? rectFromNode.width - _width / 2 : rectFromNode.width / 2),
95
95
  y: rectFromNode.y + (isCompound ? 0 : rectFromNode.height / 2)
96
96
  } : {
@@ -99,22 +99,22 @@ function ElementDetailsCard({
99
99
  };
100
100
  const fromScale = rectFromNode ? Math.min(rectFromNode.width / _width, rectFromNode.height / _height, 0.9) : 1;
101
101
  const left = Math.round(
102
- clamp(fromPositon.x - _width / 2, {
102
+ clamp(fromPosition.x - _width / 2, {
103
103
  min: MIN_PADDING,
104
104
  max: windowWidth - _width - MIN_PADDING
105
105
  })
106
106
  );
107
107
  const top = Math.round(
108
- clamp(fromPositon.y - (isCompound ? 0 : 60), {
108
+ clamp(fromPosition.y - (isCompound ? 0 : 60), {
109
109
  min: MIN_PADDING,
110
110
  max: windowHeight - _height - MIN_PADDING
111
111
  })
112
112
  );
113
- const originX = clamp((fromPositon.x - left) / _width, {
113
+ const originX = clamp((fromPosition.x - left) / _width, {
114
114
  min: 0.1,
115
115
  max: 0.9
116
116
  });
117
- const originY = clamp((fromPositon.y - top) / _height, {
117
+ const originY = clamp((fromPosition.y - top) / _height, {
118
118
  min: 0.1,
119
119
  max: 0.9
120
120
  });
@@ -1,7 +1,7 @@
1
1
  import { ElementDetailsActorRef } from './actor';
2
2
  import { Context } from 'react';
3
3
  /**
4
- * To improve experience with HMR, we use `createSafeContext` as a boundary for hoooks
4
+ * To improve experience with HMR, we use `createSafeContext` as a boundary for hooks
5
5
  */
6
6
  export declare const ElementDetailsActorContext: Context<ElementDetailsActorRef>;
7
7
  export declare const useElementDetailsActorRef: () => ElementDetailsActorRef;