@likec4/diagram 1.39.2 → 1.39.3

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.
@@ -1043,10 +1043,14 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
1043
1043
  }) {
1044
1044
  const [matches2, setMatches] = useState(
1045
1045
  getInitialValueInEffect ? initialValue : getInitialValue(query)
1046
- ), queryRef = useRef(null);
1046
+ );
1047
1047
  return useEffect(() => {
1048
- if ("matchMedia" in window)
1049
- return queryRef.current = window.matchMedia(query), setMatches(queryRef.current.matches), attachMediaListener(queryRef.current, (event) => setMatches(event.matches));
1048
+ try {
1049
+ const mediaQuery = window.matchMedia(query);
1050
+ return setMatches(mediaQuery.matches), attachMediaListener(mediaQuery, (event) => setMatches(event.matches));
1051
+ } catch {
1052
+ return;
1053
+ }
1050
1054
  }, [query]), matches2 || !1;
1051
1055
  }
1052
1056
  function useDebouncedState(defaultValue, wait, options = { leading: !1 }) {
@@ -1063,7 +1067,7 @@ function useDebouncedState(defaultValue, wait, options = { leading: !1 }) {
1063
1067
  return [value, debouncedSetValue];
1064
1068
  }
1065
1069
  function useDebouncedValue(value, wait, options = { leading: !1 }) {
1066
- const [_value, setValue] = useState(value), mountedRef = useRef(!1), timeoutRef = useRef(null), cooldownRef = useRef(!1), cancel2 = () => window.clearTimeout(timeoutRef.current);
1070
+ const [_value, setValue] = useState(value), mountedRef = useRef(!1), timeoutRef = useRef(null), cooldownRef = useRef(!1), cancel2 = useCallback(() => window.clearTimeout(timeoutRef.current), []);
1067
1071
  return useEffect(() => {
1068
1072
  mountedRef.current && (!cooldownRef.current && options.leading ? (cooldownRef.current = !0, setValue(value)) : (cancel2(), timeoutRef.current = window.setTimeout(() => {
1069
1073
  cooldownRef.current = !1, setValue(value);
@@ -5836,27 +5840,18 @@ function usePopover(options) {
5836
5840
  }, floating = useFloating({
5837
5841
  strategy: options.strategy,
5838
5842
  placement: options.preventPositionChangeWhenVisible ? options.positionRef.current : options.position,
5839
- middleware: getPopoverMiddlewares(options, () => floating, env),
5840
- // Only use whileElementsMounted when elements are conditionally rendered (not keepMounted)
5841
- // When keepMounted=true, elements are hidden with CSS and we need manual autoUpdate control
5842
- whileElementsMounted: options.keepMounted ? void 0 : autoUpdate
5843
+ middleware: getPopoverMiddlewares(options, () => floating, env)
5843
5844
  });
5844
5845
  return useEffect(() => {
5845
- if (!(!options.keepMounted || !floating.refs.reference.current || !floating.refs.floating.current) && _opened)
5846
+ if (!(!floating.refs.reference.current || !floating.refs.floating.current) && _opened)
5846
5847
  return autoUpdate(
5847
5848
  floating.refs.reference.current,
5848
5849
  floating.refs.floating.current,
5849
5850
  floating.update
5850
5851
  );
5851
- }, [
5852
- options.keepMounted,
5853
- _opened,
5854
- floating.refs.reference,
5855
- floating.refs.floating,
5856
- floating.update
5857
- ]), useDidUpdate(() => {
5852
+ }, [_opened, floating.update]), useDidUpdate(() => {
5858
5853
  options.onPositionChange?.(floating.placement), options.positionRef.current = floating.placement;
5859
- }, [floating.placement]), useDidUpdate(() => {
5854
+ }, [floating.placement, options.preventPositionChangeWhenVisible]), useDidUpdate(() => {
5860
5855
  _opened !== previouslyOpened.current && (_opened ? options.onOpen?.() : options.onClose?.()), previouslyOpened.current = _opened;
5861
5856
  }, [_opened, options.onClose, options.onOpen]), useDidUpdate(() => {
5862
5857
  let timeout2 = -1;
package/bundle/custom.js CHANGED
@@ -1,5 +1,5 @@
1
- import { du as customNode, eh as useLikeC4ViewModel } from "./chunk-CaxOLfbm.js";
2
- import { el, en, cd, eo, d2, ep, ce, eq, d0, d1, em, er, es, cf, c_, et, d9, eu, cg, d3, d4, cF, d6, d5, ev, dB, dm, e9, dr, ex, ey, ez, cG, dx, ew, cc, cz, cV, c6, cU, cm, cl, c7, ei, cR, cM, ej, cL, dU, cu, dE, ek, bf, c5, c8, dv, b9 } from "./chunk-CaxOLfbm.js";
1
+ import { du as customNode, eh as useLikeC4ViewModel } from "./chunk-C2OWyQIU.js";
2
+ import { el, en, cd, eo, d2, ep, ce, eq, d0, d1, em, er, es, cf, c_, et, d9, eu, cg, d3, d4, cF, d6, d5, ev, dB, dm, e9, dr, ex, ey, ez, cG, dx, ew, cc, cz, cV, c6, cU, cm, cl, c7, ei, cR, cM, ej, cL, dU, cu, dE, ek, bf, c5, c8, dv, b9 } from "./chunk-C2OWyQIU.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  function customDiagramNode(Node) {
5
5
  return customNode((props) => {