likec4 1.39.0 → 1.39.1

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.
@@ -1403,6 +1403,14 @@ function usePrevious$1(value) {
1403
1403
  ref.current = value;
1404
1404
  }, [value]), ref.current;
1405
1405
  }
1406
+ function useInViewport() {
1407
+ const observer = useRef(null), [inViewport, setInViewport] = useState(!1);
1408
+ return { ref: useCallback((node2) => {
1409
+ typeof IntersectionObserver < "u" && (node2 && !observer.current ? observer.current = new IntersectionObserver(
1410
+ (entries) => setInViewport(entries.some((entry) => entry.isIntersecting))
1411
+ ) : observer.current?.disconnect(), node2 ? observer.current?.observe(node2) : setInViewport(!1));
1412
+ }, []), inViewport };
1413
+ }
1406
1414
  function useMutationObserver(callback, options, target) {
1407
1415
  const observer = useRef(null), ref = useRef(null);
1408
1416
  return useEffect(() => {
@@ -30086,9 +30094,9 @@ function m$3(r2) {
30086
30094
  }
30087
30095
  var d$4 = (r2) => typeof r2 == "function" && r2.length === 1;
30088
30096
  function m$2(...r2) {
30089
- return u$8(o$8, r2);
30097
+ return u$8(o$9, r2);
30090
30098
  }
30091
- function o$8(r2, t2) {
30099
+ function o$9(r2, t2) {
30092
30100
  let e2 = [...r2];
30093
30101
  return e2.sort(t2), e2;
30094
30102
  }
@@ -30122,6 +30130,11 @@ function p$2(...e2) {
30122
30130
  return u$8(t$7, e2);
30123
30131
  }
30124
30132
  var t$7 = (e2, o2) => e2[o2];
30133
+ function o$8(r2, n2) {
30134
+ let e2 = Math.ceil(r2), t2 = Math.floor(n2);
30135
+ if (t2 < e2) throw new RangeError(`randomInteger: The range [${r2.toString()},${n2.toString()}] contains no integer`);
30136
+ return Math.floor(Math.random() * (t2 - e2 + 1) + e2);
30137
+ }
30125
30138
  function a$5(...r2) {
30126
30139
  return u$8(o$7, r2);
30127
30140
  }
@@ -31034,11 +31047,12 @@ function useTagSpecification(tag) {
31034
31047
  }
31035
31048
  const RootContainerContext = createContext(createRef());
31036
31049
  function RootContainer({
31050
+ id: id2,
31037
31051
  className,
31038
31052
  reduceGraphics = !1,
31039
31053
  children: children2
31040
31054
  }) {
31041
- const id2 = useId$2(), ref = useRef(null), $isPanning = usePanningAtom();
31055
+ const ref = useRef(null), $isPanning = usePanningAtom();
31042
31056
  return useEffect(() => $isPanning.listen((isPanning) => {
31043
31057
  ref.current?.setAttribute("data-likec4-diagram-panning", isPanning ? "true" : "false");
31044
31058
  }), [$isPanning]), /* @__PURE__ */ jsx(
@@ -36502,8 +36516,7 @@ const EdgeLabel = forwardRef(({
36502
36516
  className: cx(classes2.root, "likec4-edge-label", className),
36503
36517
  "data-edge-id": id2,
36504
36518
  animate: {
36505
- originY: 0.25,
36506
- scale: isHovered && !selected2 ? 1.08 : 1
36519
+ scale: isHovered && !selected2 ? 1.06 : 1
36507
36520
  },
36508
36521
  ...rest,
36509
36522
  children: [
@@ -47808,13 +47821,16 @@ const scrollArea = css({
47808
47821
  fontSize: "xxs",
47809
47822
  fontWeight: 500,
47810
47823
  whiteSpace: "nowrap",
47811
- padding: "[2px 4px]",
47824
+ paddingX: "1",
47825
+ paddingY: "0.5",
47812
47826
  borderRadius: "[2px]",
47813
- background: "var(--likec4-palette-fill)/30",
47814
- lineHeight: "[1.11]",
47815
- mixBlendMode: "hard-light",
47827
+ background: {
47828
+ _light: "var(--likec4-palette-fill)/90",
47829
+ _dark: "var(--likec4-palette-fill)/60"
47830
+ },
47831
+ lineHeight: "1",
47816
47832
  color: {
47817
- _light: "[color-mix(in srgb, var(--likec4-palette-stroke), {colors.likec4.mixColor} 60%)]",
47833
+ _light: "var(--likec4-palette-hiContrast)",
47818
47834
  _dark: "var(--likec4-palette-loContrast)"
47819
47835
  }
47820
47836
  }), title$1 = css({
@@ -47840,9 +47856,9 @@ function selectDiagramContext(c2) {
47840
47856
  }
47841
47857
  const RelationshipPopover = memo$2(() => {
47842
47858
  const actorRef = xstateReact_cjsExports.useActorRef(RelationshipPopoverActorLogic), diagram = useDiagram(), { viewId, selected: selected2 } = useDiagramContext(selectDiagramContext), openedEdgeId = xstateReact_cjsExports.useSelector(actorRef, (s2) => s2.hasTag("opened") ? s2.context.edgeId : null);
47843
- useUpdateEffect(() => {
47859
+ useOnDiagramEvent("viewChange", () => {
47844
47860
  actorRef.send({ type: "close" });
47845
- }, [viewId]), useOnDiagramEvent("edgeMouseEnter", ({ edge }) => {
47861
+ }), useOnDiagramEvent("edgeMouseEnter", ({ edge }) => {
47846
47862
  actorRef.send({ type: "xyedge.mouseEnter", edgeId: edge.data.id });
47847
47863
  }), useOnDiagramEvent("edgeMouseLeave", () => {
47848
47864
  actorRef.send({ type: "xyedge.mouseLeave" });
@@ -47850,7 +47866,7 @@ const RelationshipPopover = memo$2(() => {
47850
47866
  actorRef.send({ type: "close" });
47851
47867
  }), useOnDiagramEvent("walkthroughStarted", () => {
47852
47868
  actorRef.send({ type: "close" });
47853
- }), useUpdateEffect(() => {
47869
+ }), useEffect(() => {
47854
47870
  selected2 ? actorRef.send({ type: "xyedge.select", edgeId: selected2 }) : actorRef.send({ type: "xyedge.unselect" });
47855
47871
  }, [selected2]);
47856
47872
  const onMouseEnter = useCallback((event) => {
@@ -47888,7 +47904,7 @@ const RelationshipPopover = memo$2(() => {
47888
47904
  onMouseLeave
47889
47905
  }
47890
47906
  );
47891
- }), getEdgeLabelElement = (edgeId, container2) => container2?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? null, selectTransform = (s2) => roundDpr(s2.transform[0]) + " " + roundDpr(s2.transform[1]) + " " + s2.transform[2].toFixed(3), RelationshipPopoverInternal = ({
47907
+ }), getEdgeLabelElement = (edgeId, container2) => container2?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? null, POPOVER_PADDING = 8, RelationshipPopoverInternal = ({
47892
47908
  viewId,
47893
47909
  diagramEdge,
47894
47910
  sourceNode,
@@ -47896,21 +47912,21 @@ const RelationshipPopover = memo$2(() => {
47896
47912
  onMouseEnter,
47897
47913
  onMouseLeave
47898
47914
  }) => {
47899
- const ref = useRef(null), { enableNavigateTo, enableVscode } = useEnabledFeatures(), { onOpenSource } = useDiagramEventHandlers(), { portalProps } = useMantinePortalProps(), [referenceEl, setReferenceEl] = useState(null), viewport = useXYStore(selectTransform);
47915
+ const ref = useRef(null), { enableNavigateTo, enableVscode } = useEnabledFeatures(), { onOpenSource } = useDiagramEventHandlers(), { portalProps } = useMantinePortalProps(), [referenceEl, setReferenceEl] = useState(null);
47900
47916
  useEffect(() => {
47901
47917
  setReferenceEl(getEdgeLabelElement(diagramEdge.id, portalProps?.target));
47902
- }, [diagramEdge, viewport]), useEffect(() => {
47918
+ }, [diagramEdge]), useEffect(() => {
47903
47919
  const reference = referenceEl, popper = ref.current;
47904
47920
  if (!reference || !popper)
47905
47921
  return;
47906
47922
  let wasCanceled = !1;
47907
47923
  const cleanup = autoUpdate(reference, popper, () => {
47908
47924
  computePosition(reference, popper, {
47909
- placement: "bottom",
47925
+ placement: "bottom-start",
47910
47926
  middleware: [
47911
47927
  offset$2(2),
47912
47928
  autoPlacement({
47913
- padding: 16,
47929
+ padding: POPOVER_PADDING,
47914
47930
  allowedPlacements: [
47915
47931
  "bottom-start",
47916
47932
  "bottom-end",
@@ -47923,21 +47939,24 @@ const RelationshipPopover = memo$2(() => {
47923
47939
  ]
47924
47940
  }),
47925
47941
  size$1({
47926
- padding: 16,
47942
+ padding: POPOVER_PADDING,
47927
47943
  apply({ availableHeight, availableWidth, elements }) {
47928
47944
  wasCanceled || Object.assign(elements.floating.style, {
47929
- maxWidth: `${u(roundDpr(availableWidth), { min: 150, max: 400 })}px`,
47945
+ maxWidth: `${u(roundDpr(availableWidth), { min: 200, max: 400 })}px`,
47930
47946
  maxHeight: `${u(roundDpr(availableHeight), { min: 0, max: 500 })}px`
47931
47947
  });
47932
47948
  }
47933
47949
  }),
47934
47950
  hide$1({
47935
- padding: 16
47951
+ padding: POPOVER_PADDING * 2
47936
47952
  })
47937
47953
  ]
47938
47954
  }).then(({ x: x2, y: y2, middlewareData }) => {
47939
47955
  wasCanceled || (popper.style.transform = `translate(${roundDpr(x2)}px, ${roundDpr(y2)}px)`, popper.style.visibility = middlewareData.hide?.referenceHidden ? "hidden" : "visible");
47940
47956
  });
47957
+ }, {
47958
+ ancestorResize: !1,
47959
+ animationFrame: !0
47941
47960
  });
47942
47961
  return () => {
47943
47962
  wasCanceled = !0, cleanup();
@@ -47995,7 +48014,7 @@ const RelationshipPopover = memo$2(() => {
47995
48014
  styles: {
47996
48015
  viewport: {
47997
48016
  overscrollBehavior: "contain",
47998
- minWidth: 150
48017
+ minWidth: 180
47999
48018
  }
48000
48019
  },
48001
48020
  className: cx(
@@ -48015,9 +48034,9 @@ const RelationshipPopover = memo$2(() => {
48015
48034
  VStack,
48016
48035
  {
48017
48036
  css: {
48018
- gap: "3.5",
48037
+ gap: "3",
48019
48038
  padding: "4",
48020
- paddingTop: "2.5"
48039
+ paddingTop: "2"
48021
48040
  },
48022
48041
  children: [
48023
48042
  /* @__PURE__ */ jsx(
@@ -48038,12 +48057,19 @@ const RelationshipPopover = memo$2(() => {
48038
48057
  }
48039
48058
  ),
48040
48059
  direct.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
48041
- /* @__PURE__ */ jsx(Divider$1, { label: /* @__PURE__ */ jsx(Label, { children: "direct relationships" }), labelPosition: "left" }),
48060
+ /* @__PURE__ */ jsx(Label, { children: "DIRECT RELATIONSHIPS" }),
48042
48061
  direct.map(renderRelationship)
48043
48062
  ] }),
48044
48063
  nested.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
48045
- direct.length > 0 && /* @__PURE__ */ jsx(Space, {}),
48046
- /* @__PURE__ */ jsx(Divider$1, { label: /* @__PURE__ */ jsx(Label, { children: "resolved from nested" }), labelPosition: "left" }),
48064
+ /* @__PURE__ */ jsx(
48065
+ Label,
48066
+ {
48067
+ css: {
48068
+ mt: direct.length > 0 ? "2" : "0"
48069
+ },
48070
+ children: "RESOLVED FROM NESTED"
48071
+ }
48072
+ ),
48047
48073
  nested.map(renderRelationship)
48048
48074
  ] })
48049
48075
  ]
@@ -48060,7 +48086,7 @@ const RelationshipPopover = memo$2(() => {
48060
48086
  onNavigateTo,
48061
48087
  onOpenSource
48062
48088
  }, ref) => {
48063
- const sourceId = getShortId(r2, r2.source.id, sourceNode), targetId = getShortId(r2, r2.target.id, targetNode), navigateTo = onNavigateTo && r2.navigateTo?.id !== viewId ? r2.navigateTo?.id : void 0, links = r2.links;
48089
+ const sourceId = getEndpointId(r2, "source", sourceNode), targetId = getEndpointId(r2, "target", targetNode), navigateTo = onNavigateTo && r2.navigateTo?.id !== viewId ? r2.navigateTo?.id : void 0, links = r2.links;
48064
48090
  return /* @__PURE__ */ jsxs(
48065
48091
  VStack,
48066
48092
  {
@@ -48068,8 +48094,8 @@ const RelationshipPopover = memo$2(() => {
48068
48094
  className: bleed({
48069
48095
  block: "2",
48070
48096
  inline: "2",
48071
- paddingBlock: "2",
48072
- paddingInline: "2",
48097
+ paddingY: "2.5",
48098
+ paddingX: "2",
48073
48099
  gap: "1",
48074
48100
  rounded: "sm",
48075
48101
  backgroundColor: {
@@ -48080,42 +48106,40 @@ const RelationshipPopover = memo$2(() => {
48080
48106
  }
48081
48107
  }),
48082
48108
  children: [
48083
- /* @__PURE__ */ jsxs(HStack, { gap: "0.5", children: [
48084
- /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": sourceNode.color, className: endpoint, children: sourceId }),
48109
+ /* @__PURE__ */ jsx(HStack, { gap: "0.5", children: /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 200, children: [
48110
+ /* @__PURE__ */ jsx(Tooltip$1, { label: sourceId.full, offset: 2, position: "top-start", children: /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": sourceNode.color, className: endpoint, children: sourceId.short }) }),
48085
48111
  /* @__PURE__ */ jsx(IconArrowRight, { stroke: 2.5, size: "11px", opacity: 0.65 }),
48086
- /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": targetNode.color, className: endpoint, children: targetId }),
48087
- /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 100, children: [
48088
- navigateTo && /* @__PURE__ */ jsx(Tooltip$1, { label: "Open dynamic view", children: /* @__PURE__ */ jsx(
48089
- ActionIcon$1,
48090
- {
48091
- size: "sm",
48092
- radius: "sm",
48093
- variant: "default",
48094
- onClick: (event) => {
48095
- event.stopPropagation(), onNavigateTo?.(navigateTo);
48096
- },
48097
- style: {
48098
- alignSelf: "flex-end"
48099
- },
48100
- role: "button",
48101
- children: /* @__PURE__ */ jsx(IconZoomScan, { size: "80%", stroke: 2 })
48102
- }
48103
- ) }),
48104
- onOpenSource && /* @__PURE__ */ jsx(Tooltip$1, { label: "Open source", children: /* @__PURE__ */ jsx(
48105
- ActionIcon$1,
48106
- {
48107
- size: "sm",
48108
- radius: "sm",
48109
- variant: "default",
48110
- onClick: (event) => {
48111
- event.stopPropagation(), onOpenSource();
48112
- },
48113
- role: "button",
48114
- children: /* @__PURE__ */ jsx(IconFileSymlink, { size: "80%", stroke: 2 })
48115
- }
48116
- ) })
48117
- ] })
48118
- ] }),
48112
+ /* @__PURE__ */ jsx(Tooltip$1, { label: targetId.full, offset: 2, position: "top-start", children: /* @__PURE__ */ jsx(Text, { component: "div", "data-likec4-color": targetNode.color, className: endpoint, children: targetId.short }) }),
48113
+ navigateTo && /* @__PURE__ */ jsx(Tooltip$1, { label: "Open dynamic view", children: /* @__PURE__ */ jsx(
48114
+ ActionIcon$1,
48115
+ {
48116
+ size: "sm",
48117
+ radius: "sm",
48118
+ variant: "default",
48119
+ onClick: (event) => {
48120
+ event.stopPropagation(), onNavigateTo?.(navigateTo);
48121
+ },
48122
+ style: {
48123
+ alignSelf: "flex-end"
48124
+ },
48125
+ role: "button",
48126
+ children: /* @__PURE__ */ jsx(IconZoomScan, { size: "80%", stroke: 2 })
48127
+ }
48128
+ ) }),
48129
+ onOpenSource && /* @__PURE__ */ jsx(Tooltip$1, { label: "Open source", children: /* @__PURE__ */ jsx(
48130
+ ActionIcon$1,
48131
+ {
48132
+ size: "sm",
48133
+ radius: "sm",
48134
+ variant: "default",
48135
+ onClick: (event) => {
48136
+ event.stopPropagation(), onOpenSource();
48137
+ },
48138
+ role: "button",
48139
+ children: /* @__PURE__ */ jsx(IconFileSymlink, { size: "80%", stroke: 2 })
48140
+ }
48141
+ ) })
48142
+ ] }) }),
48119
48143
  /* @__PURE__ */ jsx(Box, { className: title$1, children: r2.title || "untitled" }),
48120
48144
  r2.kind && /* @__PURE__ */ jsxs(HStack, { gap: "2", children: [
48121
48145
  /* @__PURE__ */ jsx(Label, { children: "kind" }),
@@ -48150,13 +48174,13 @@ const RelationshipPopover = memo$2(() => {
48150
48174
  ]
48151
48175
  }
48152
48176
  );
48153
- }), Label = styled("span", {
48177
+ }), Label = styled("div", {
48154
48178
  base: {
48155
- display: "inline-block",
48179
+ display: "block",
48156
48180
  fontSize: "xxs",
48157
48181
  fontWeight: 500,
48158
48182
  userSelect: "none",
48159
- lineHeight: "[1.11]",
48183
+ lineHeight: "sm",
48160
48184
  color: "mantine.colors.dimmed"
48161
48185
  }
48162
48186
  }), Tooltip$1 = Tooltip$7.withProps({
@@ -48167,9 +48191,9 @@ const RelationshipPopover = memo$2(() => {
48167
48191
  offset: 8,
48168
48192
  withinPortal: !1
48169
48193
  });
48170
- function getShortId(r2, actualEndpointId, diagramNode) {
48171
- const diagramNodeId = r2.isDeploymentRelation() ? diagramNode.id : diagramNode.modelRef || "";
48172
- return nameFromFqn(diagramNodeId) + actualEndpointId.slice(diagramNodeId.length);
48194
+ function getEndpointId(r2, endpoint2, diagramNode) {
48195
+ const diagramNodeId = r2.isDeploymentRelation() ? diagramNode.id : diagramNode.modelRef || "", full = r2[endpoint2].id, short = nameFromFqn(diagramNodeId) + full.slice(diagramNodeId.length);
48196
+ return { full, short };
48173
48197
  }
48174
48198
  const root = css({
48175
48199
  height: "30px",
@@ -50236,7 +50260,7 @@ const channels = new Channels({ r: 0, g: 0, b: 0, a: 0 }, "transparent"), Hex =
50236
50260
  for (const c2 in channels2)
50237
50261
  adjustments[c2] = delta(ch[c2], channels2[c2], Utils.channel.max[c2]);
50238
50262
  return adjust(color2, adjustments);
50239
- }, globalsCss = ".likec4-shadow-root dialog{color:var(--mantine-color-text)}.likec4-root{overflow:hidden;position:relative;padding:0;margin:0;width:100%;height:100%;border:0px solid transparent;container-name:likec4-root;container-type:size}.likec4-root .react-flow:is(.not-initialized){opacity:0}.likec4-root .react-flow{contain:paint;--xy-background-color: var(--colors-likec4-background);--xy-background-pattern-color: var(--colors-likec4-background-pattern, var(--colors-likec4-background))}.likec4-root .react-flow:is(.bg-transparent){background:transparent!important;--xy-background-color: transparent !important}.likec4-root .react-flow .react-flow__pane{user-select:none;--webkit-user-select: none}.likec4-static-view .react-flow .react-flow__attribution{display:none}:where(.likec4-root .mantine-ActionIcon-icon) .tabler-icon{width:75%;height:75%}.likec4-root .likec4-edge-label-container{top:0;left:0;position:absolute;width:auto;height:auto}.likec4-root :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed]){opacity:.25}.likec4-root .likec4-edge-label-container:is([data-likec4-dimmed]){opacity:.25}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed]){filter:grayscale(85%) blur(3px)}.likec4-root:not([data-likec4-reduced-graphics]) .likec4-edge-label-container:is([data-likec4-dimmed]){filter:grayscale(85%) blur(3px)}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed=true]){transition-property:opacity,filter;transition-timing-function:cubic-bezier(.5,0,.2,1);transition-duration:.6s}.likec4-root:not([data-likec4-reduced-graphics]) .likec4-edge-label-container:is([data-likec4-dimmed=true]){transition-property:opacity,filter;transition-timing-function:cubic-bezier(.5,0,.2,1);transition-duration:.6s}.likec4-root .react-flow :where(.react-flow__nodes,.react-flow__edges,.react-flow__edgelabel-renderer){display:contents}.likec4-root .react-flow__node.draggable:has(.likec4-compound-node){cursor:default}[data-mantine-color-scheme=dark] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>:where(svg,.likec4-edge-label-container){mix-blend-mode:plus-lighter}[data-mantine-color-scheme=light] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>:where(svg,.likec4-edge-label-container){mix-blend-mode:screen}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-stroke-width: 3;--xy-edge-stroke: var(--likec4-palette-relation-stroke);--xy-edge-stroke-selected: var(--likec4-palette-relation-stroke-selected);--xy-edge-label-color: var(--likec4-palette-relation-label);--xy-edge-label-background-color: var(--likec4-palette-relation-label-bg)}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container):is([data-likec4-hovered=true],[data-edge-active=true]){--xy-edge-stroke-width: 4;--xy-edge-stroke: var(--likec4-palette-relation-stroke-selected)}[data-mantine-color-scheme=dark] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 50%, transparent)}[data-mantine-color-scheme=light] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-color: color-mix(in srgb, var(--likec4-palette-relation-label), rgba(255 255 255 / .85) 40%);--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 60%, transparent)}", scheme = (scheme2) => `[data-mantine-color-scheme="${scheme2}"]`, whenDark = scheme("dark"), whenLight = scheme("light"), MAX_DEPTH = 5, generateCompoundColors = (name, colors2, depth) => {
50263
+ }, globalsCss = ".likec4-shadow-root dialog{color:var(--mantine-color-text)}.likec4-root{overflow:hidden;position:relative;padding:0;margin:0;width:100%;height:100%;border:0px solid transparent;container-name:likec4-root;container-type:size}.likec4-root .react-flow:is(.not-initialized){opacity:0}.likec4-root .react-flow{contain:paint;--xy-background-color: var(--colors-likec4-background);--xy-background-pattern-color: var(--colors-likec4-background-pattern, var(--colors-likec4-background))}.likec4-root .react-flow:is(.bg-transparent){background:transparent!important;--xy-background-color: transparent !important}.likec4-root .react-flow .react-flow__pane{user-select:none;--webkit-user-select: none}.likec4-static-view .react-flow .react-flow__attribution{display:none}:where(.likec4-root .mantine-ActionIcon-icon) .tabler-icon{width:75%;height:75%}.likec4-root .likec4-edge-label-container{top:0;left:0;position:absolute;width:auto;height:auto}.likec4-root :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed]){opacity:.25}.likec4-root .likec4-edge-label-container:is([data-likec4-dimmed]){opacity:.25}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed]){filter:grayscale(85%)}.likec4-root:not([data-likec4-reduced-graphics]) .likec4-edge-label-container:is([data-likec4-dimmed]){filter:grayscale(85%)}.likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__node,.react-flow__edge):has([data-likec4-dimmed=true]){transition-property:opacity,filter;transition-timing-function:cubic-bezier(.5,0,.2,1);transition-duration:.6s}.likec4-root:not([data-likec4-reduced-graphics]) .likec4-edge-label-container:is([data-likec4-dimmed=true]){transition-property:opacity,filter;transition-timing-function:cubic-bezier(.5,0,.2,1);transition-duration:.6s}.likec4-root .react-flow :where(.react-flow__nodes,.react-flow__edges,.react-flow__edgelabel-renderer){display:contents}.likec4-root .react-flow__node.draggable:has(.likec4-compound-node){cursor:default}[data-mantine-color-scheme=dark] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>:where(svg,.likec4-edge-label-container){mix-blend-mode:plus-lighter}[data-mantine-color-scheme=light] .likec4-root:not([data-likec4-reduced-graphics]) :where(.react-flow__edges,.react-flow__edgelabel-renderer)>:where(svg,.likec4-edge-label-container){mix-blend-mode:screen}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-stroke-width: 3;--xy-edge-stroke: var(--likec4-palette-relation-stroke);--xy-edge-stroke-selected: var(--likec4-palette-relation-stroke-selected);--xy-edge-label-color: var(--likec4-palette-relation-label);--xy-edge-label-background-color: var(--likec4-palette-relation-label-bg)}.likec4-root :where(.likec4-edge-container,.likec4-edge-label-container):is([data-likec4-hovered=true],[data-edge-active=true]){--xy-edge-stroke-width: 4;--xy-edge-stroke: var(--likec4-palette-relation-stroke-selected)}[data-mantine-color-scheme=dark] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 50%, transparent)}[data-mantine-color-scheme=light] .likec4-root :where(.likec4-edge-container,.likec4-edge-label-container){--xy-edge-label-color: color-mix(in srgb, var(--likec4-palette-relation-label), rgba(255 255 255 / .85) 40%);--xy-edge-label-background-color: color-mix(in srgb, var(--likec4-palette-relation-label-bg) 60%, transparent)}", scheme = (scheme2) => `[data-mantine-color-scheme="${scheme2}"]`, whenDark = scheme("dark"), whenLight = scheme("light"), MAX_DEPTH = 5, generateCompoundColors = (rootSelector, name, colors2, depth) => {
50240
50264
  const compoundDarkColor = (color2) => toHex(
50241
50265
  scale(color2, {
50242
50266
  l: -22 - 5 * depth,
@@ -50247,7 +50271,7 @@ const channels = new Channels({ r: 0, g: 0, b: 0, a: 0 }, "transparent"), Hex =
50247
50271
  l: -20 - 3 * depth,
50248
50272
  s: -3 - 6 * depth
50249
50273
  })
50250
- ), selector3 = `:where([data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
50274
+ ), selector3 = `:where(${rootSelector} [data-likec4-color="${name}"][data-compound-depth="${depth}"])`;
50251
50275
  return `
50252
50276
  ${selector3} {
50253
50277
  --likec4-palette-fill: ${compoundLightColor(colors2.elements.fill)};
@@ -50259,8 +50283,8 @@ ${whenDark} ${selector3} {
50259
50283
  }
50260
50284
  `.trim();
50261
50285
  };
50262
- function toStyle(name, colors2) {
50263
- const selector3 = `:where([data-likec4-color=${name}])`;
50286
+ function toStyle(rootSelector, name, colors2) {
50287
+ const selector3 = `:where(${rootSelector} [data-likec4-color=${name}])`;
50264
50288
  return [
50265
50289
  `
50266
50290
  ${selector3} {
@@ -50280,37 +50304,67 @@ ${whenDark} ${selector3} {
50280
50304
  }
50281
50305
 
50282
50306
  `.trim(),
50283
- ...a$5(1, MAX_DEPTH + 1).map((depth) => generateCompoundColors(name, colors2, depth))
50307
+ ...a$5(1, MAX_DEPTH + 1).map((depth) => generateCompoundColors(rootSelector, name, colors2, depth))
50284
50308
  ].join(`
50285
50309
  `);
50286
50310
  }
50287
- const builtInColors = ThemeColors.map(
50288
- (color2) => toStyle(color2, {
50289
- elements: defaultTheme.elements[color2],
50290
- relationships: defaultTheme.relationships[color2]
50291
- })
50292
- ).join(`
50293
- `);
50294
- function generateCustomColorStyles(customColors) {
50311
+ function generateCustomColorStyles(customColors, rootSelector) {
50295
50312
  return C(
50296
50313
  t$1(customColors),
50297
- m$1(([name, color2]) => toStyle(name, color2)),
50314
+ m$1(([name, color2]) => toStyle(rootSelector, name, color2)),
50298
50315
  r$2(`
50299
50316
  `)
50300
50317
  );
50301
50318
  }
50302
- function LikeC4Styles() {
50303
- const nonce = useMantineStyleNonce()?.(), { customColors } = useLikeC4Specification(), customColorsStyles = customColors ? generateCustomColorStyles(customColors) : "";
50304
- return /* @__PURE__ */ jsx(MemoizedStyles, { nonce, customColorsStyles, builtInColors });
50319
+ function generateBuiltInColorStyles(rootSelector) {
50320
+ return C(
50321
+ ThemeColors,
50322
+ m$1(
50323
+ (color2) => toStyle(rootSelector, color2, {
50324
+ elements: defaultTheme.elements[color2],
50325
+ relationships: defaultTheme.relationships[color2]
50326
+ })
50327
+ ),
50328
+ r$2(`
50329
+ `)
50330
+ );
50331
+ }
50332
+ function LikeC4Styles({ id: id2 }) {
50333
+ const rootSelector = `#${id2}`, nonce = useMantineStyleNonce()?.(), { customColors } = useLikeC4Specification(), customColorsStyles = customColors ? generateCustomColorStyles(customColors, rootSelector) : "", builtInColors = generateBuiltInColorStyles(rootSelector);
50334
+ return /* @__PURE__ */ jsx(
50335
+ MemoizedStyles,
50336
+ {
50337
+ id: id2,
50338
+ nonce,
50339
+ customColorsStyles,
50340
+ builtInColors
50341
+ }
50342
+ );
50305
50343
  }
50306
- const MemoizedStyles = memo$2(({ nonce, customColorsStyles, builtInColors: builtInColors2 }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
50307
- /* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-global": !0, dangerouslySetInnerHTML: { __html: globalsCss }, nonce }),
50308
- /* @__PURE__ */ jsx("style", { type: "text/css", "data-likec4-colors": !0, dangerouslySetInnerHTML: { __html: builtInColors2 }, nonce }),
50344
+ const MemoizedStyles = memo$2(({ id: id2, nonce, customColorsStyles, builtInColors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
50345
+ /* @__PURE__ */ jsx(
50346
+ "style",
50347
+ {
50348
+ type: "text/css",
50349
+ "data-likec4-global": id2,
50350
+ dangerouslySetInnerHTML: { __html: globalsCss.replaceAll(".likec4-root", `#${id2}.likec4-root`) },
50351
+ nonce
50352
+ }
50353
+ ),
50354
+ /* @__PURE__ */ jsx(
50355
+ "style",
50356
+ {
50357
+ type: "text/css",
50358
+ "data-likec4-colors": id2,
50359
+ dangerouslySetInnerHTML: { __html: builtInColors },
50360
+ nonce
50361
+ }
50362
+ ),
50309
50363
  customColorsStyles && /* @__PURE__ */ jsx(
50310
50364
  "style",
50311
50365
  {
50312
50366
  type: "text/css",
50313
- "data-likec4-custom-colors": !0,
50367
+ "data-likec4-custom-colors": id2,
50314
50368
  dangerouslySetInnerHTML: { __html: customColorsStyles },
50315
50369
  nonce
50316
50370
  }
@@ -53459,7 +53513,7 @@ function LikeC4Diagram({
53459
53513
  renderNodes,
53460
53514
  children: children2
53461
53515
  }) {
53462
- const initialRef = useRef(null);
53516
+ const id2 = useId$2().replace("mantine-", "likec4-"), initialRef = useRef(null);
53463
53517
  initialRef.current == null && (initialRef.current = {
53464
53518
  defaultEdges: [],
53465
53519
  defaultNodes: [],
@@ -53509,8 +53563,8 @@ function LikeC4Diagram({
53509
53563
  onBurgerMenuClick
53510
53564
  },
53511
53565
  children: /* @__PURE__ */ jsxs(ReduceGraphicsContext, { reduceGraphics: isReducedGraphicsMode, children: [
53512
- /* @__PURE__ */ jsx(LikeC4Styles, {}),
53513
- /* @__PURE__ */ jsx(RootContainer, { className, reduceGraphics: isReducedGraphicsMode, children: /* @__PURE__ */ jsx(
53566
+ /* @__PURE__ */ jsx(LikeC4Styles, { id: id2 }),
53567
+ /* @__PURE__ */ jsx(RootContainer, { id: id2, className, reduceGraphics: isReducedGraphicsMode, children: /* @__PURE__ */ jsx(
53514
53568
  ReactFlowProvider,
53515
53569
  {
53516
53570
  fitView,
@@ -53835,12 +53889,15 @@ function RouteComponent$1() {
53835
53889
  ) });
53836
53890
  }
53837
53891
  function ViewCard({ view }) {
53838
- const [visible2, setVisible] = useState(!1);
53839
- return useTimeoutEffect(() => {
53840
- setVisible(!0);
53841
- }, 100), /* @__PURE__ */ jsxs(
53892
+ const [visible2, setVisible] = useState(!1), { ref, inViewport } = useInViewport();
53893
+ return useEffect(() => {
53894
+ if (!inViewport || visible2) return;
53895
+ const tm = setTimeout(() => setVisible(!0), o$8(30, 80));
53896
+ return () => clearTimeout(tm);
53897
+ }, [inViewport]), /* @__PURE__ */ jsxs(
53842
53898
  Card,
53843
53899
  {
53900
+ ref,
53844
53901
  shadow: "xs",
53845
53902
  padding: "lg",
53846
53903
  radius: "sm",