@likec4/diagram 1.49.0 → 1.50.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: {
@@ -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;