likec4 0.46.0 → 0.47.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.
@@ -1,6 +1,9 @@
1
1
  export function isElementRef(expr) {
2
2
  return "element" in expr;
3
3
  }
4
+ export function isCustomElement(expr) {
5
+ return "custom" in expr;
6
+ }
4
7
  export function isWildcard(expr) {
5
8
  return "wildcard" in expr;
6
9
  }
@@ -232,12 +232,16 @@ export const Diagram = /* @__PURE__ */ forwardRef(
232
232
  mouse: true,
233
233
  capture: true
234
234
  },
235
- !onNodeContextMenu && !onStageContextMenu && {
235
+ !onNodeContextMenu && !onStageContextMenu ? {
236
236
  buttons: -1
237
- }
237
+ } : void 0
238
238
  )
239
239
  },
240
240
  pinch: {
241
+ eventOptions: {
242
+ passive: true,
243
+ capture: true
244
+ },
241
245
  target: containerRef,
242
246
  pointer: {
243
247
  touch: true
@@ -186,10 +186,10 @@ const NodeShape = memo(
186
186
  node,
187
187
  theme,
188
188
  springs,
189
- labelOffsetX: isNavigatable ? -18 : 0
189
+ labelOffsetX: isNavigatable ? -20 : 0
190
190
  }
191
191
  ),
192
- isNavigatable && /* @__PURE__ */ jsx(ZoomInIcon, { opacity: 0.9, size: 18, x: 18, y: 22 })
192
+ isNavigatable && /* @__PURE__ */ jsx(ZoomInIcon, { opacity: 0.9, size: 20, x: 18, y: 21 })
193
193
  ] }),
194
194
  !_isCompound && /* @__PURE__ */ jsxs(Fragment, { children: [
195
195
  /* @__PURE__ */ jsx(Shape, { node, theme, springs, isHovered }),
@@ -20,6 +20,7 @@ export const ZoomInIcon = ({ fill = "#BABABA", opacity = 1, size = 20, x, y }) =
20
20
  width: originalSize,
21
21
  height: originalSize,
22
22
  opacity,
23
+ perfectDrawEnabled: false,
23
24
  globalCompositeOperation: "luminosity"
24
25
  }
25
26
  );
@@ -23,21 +23,19 @@ export function CompoundShape({ node, theme, springs, labelOffsetX = 0 }) {
23
23
  labels.map(({ pt: [x, y], ...label }, i) => /* @__PURE__ */ jsx(
24
24
  Text,
25
25
  {
26
- x: x - 6,
27
- y: y - 8,
26
+ x: x + 4,
27
+ y,
28
28
  offsetX: labelOffsetX,
29
- width: node.size.width - x - 8 - 6 + labelOffsetX,
29
+ width: node.size.width + labelOffsetX - 4,
30
30
  fill: "#BABABA",
31
31
  fontFamily: theme.font,
32
32
  fontSize: label.fontSize,
33
33
  fontStyle: label.fontStyle ?? "normal",
34
- letterSpacing: 0.75,
35
34
  align: label.align,
36
35
  text: label.text,
37
36
  wrap: "none",
38
37
  ellipsis: true,
39
38
  perfectDrawEnabled: false,
40
- padding: 8,
41
39
  globalCompositeOperation: "luminosity"
42
40
  },
43
41
  i
@@ -42,7 +42,7 @@ function EdgeLabelBg({
42
42
  y: labelBBox.y - padding,
43
43
  width: labelBBox.width + padding * 2,
44
44
  height: labelBBox.height + padding * 2,
45
- opacity: isHovered ? 0.5 : 0.12
45
+ opacity: isHovered ? 0.75 : 0.65
46
46
  },
47
47
  immediate: !animate
48
48
  });
@@ -53,7 +53,7 @@ function EdgeLabelBg({
53
53
  perfectDrawEnabled: false,
54
54
  fill: springs.labelBgColor,
55
55
  cornerRadius: 2,
56
- globalCompositeOperation: "darken",
56
+ globalCompositeOperation: "lighten",
57
57
  hitStrokeWidth: 5
58
58
  }
59
59
  );
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
4
4
  export function useTransparentBackground(enabled = true) {
5
5
  useEffect(() => {
6
6
  const htmlEl = document.body.parentElement;
7
- if (!htmlEl || !enabled)
7
+ if (!htmlEl || enabled !== true)
8
8
  return;
9
9
  // see ../../likec4.css
10
10
  const classname = 'transparent-bg';