likec4 1.0.0 → 1.0.2

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.
@@ -10689,7 +10689,7 @@ function getStyle({
10689
10689
  };
10690
10690
  }
10691
10691
  function useStylesTransform({ props, stylesCtx, themeName }) {
10692
- const theme2 = useMantineTheme(), stylesTransform = useMantineStylesTransform();
10692
+ const theme2 = useMantineTheme(), stylesTransform = useMantineStylesTransform()?.();
10693
10693
  return {
10694
10694
  getTransformedStyles: (styles) => stylesTransform ? [
10695
10695
  ...styles.map(
@@ -10759,22 +10759,22 @@ function useStyles({
10759
10759
  function getAutoContrastValue(autoContrast, theme2) {
10760
10760
  return typeof autoContrast == "boolean" ? autoContrast : theme2.autoContrast;
10761
10761
  }
10762
- function disableTransition() {
10762
+ function disableTransition(nonce) {
10763
10763
  const style2 = document.createElement("style");
10764
- return style2.innerHTML = "*, *::before, *::after {transition: none !important;}", style2.setAttribute("data-mantine-disable-transition", "true"), document.head.appendChild(style2), () => document.querySelectorAll("[data-mantine-disable-transition]").forEach((element) => element.remove());
10764
+ return style2.setAttribute("data-mantine-styles", "inline"), style2.innerHTML = "*, *::before, *::after {transition: none !important;}", style2.setAttribute("data-mantine-disable-transition", "true"), nonce && style2.setAttribute("nonce", nonce), document.head.appendChild(style2), () => document.querySelectorAll("[data-mantine-disable-transition]").forEach((element) => element.remove());
10765
10765
  }
10766
10766
  function useMantineColorScheme({ keepTransitions } = {}) {
10767
- const clearStylesRef = reactExports.useRef(), timeoutRef = reactExports.useRef(), ctx = reactExports.useContext(MantineContext);
10767
+ const clearStylesRef = reactExports.useRef(), timeoutRef = reactExports.useRef(), ctx = reactExports.useContext(MantineContext), nonce = useMantineStyleNonce(), nonceValue = reactExports.useRef(nonce?.());
10768
10768
  if (!ctx)
10769
10769
  throw new Error("[@mantine/core] MantineProvider was not found in tree");
10770
10770
  const setColorScheme = (value) => {
10771
10771
  ctx.setColorScheme(value), clearStylesRef.current = keepTransitions ? () => {
10772
- } : disableTransition(), window.clearTimeout(timeoutRef.current), timeoutRef.current = window.setTimeout(() => {
10772
+ } : disableTransition(nonceValue.current), window.clearTimeout(timeoutRef.current), timeoutRef.current = window.setTimeout(() => {
10773
10773
  clearStylesRef.current?.();
10774
10774
  }, 10);
10775
10775
  }, clearColorScheme = () => {
10776
10776
  ctx.clearColorScheme(), clearStylesRef.current = keepTransitions ? () => {
10777
- } : disableTransition(), window.clearTimeout(timeoutRef.current), timeoutRef.current = window.setTimeout(() => {
10777
+ } : disableTransition(nonceValue.current), window.clearTimeout(timeoutRef.current), timeoutRef.current = window.setTimeout(() => {
10778
10778
  clearStylesRef.current?.();
10779
10779
  }, 10);
10780
10780
  }, osColorScheme = useColorScheme("light", { getInitialValueInEffect: !1 }), computedColorScheme = ctx.colorScheme === "auto" ? osColorScheme : ctx.colorScheme, toggleColorScheme = reactExports.useCallback(
@@ -11158,7 +11158,7 @@ const _Box = reactExports.forwardRef(
11158
11158
  renderRoot,
11159
11159
  ...others
11160
11160
  }, ref) => {
11161
- const theme2 = useMantineTheme(), Element2 = component || "div", { styleProps, rest } = extractStyleProps(others), transformedSx = useMantineSxTransform()?.(styleProps.sx), responsiveClassName = useRandomClassName(), parsedStyleProps = parseStyleProps({
11161
+ const theme2 = useMantineTheme(), Element2 = component || "div", { styleProps, rest } = extractStyleProps(others), transformedSx = useMantineSxTransform()?.()?.(styleProps.sx), responsiveClassName = useRandomClassName(), parsedStyleProps = parseStyleProps({
11162
11162
  styleProps,
11163
11163
  theme: theme2,
11164
11164
  data: STYlE_PROPS_DATA
@@ -15071,7 +15071,7 @@ function useModal({
15071
15071
  return useWindowEvent(
15072
15072
  "keydown",
15073
15073
  (event) => {
15074
- event.key === "Escape" && closeOnEscape2 && event.target?.getAttribute("data-mantine-stop-propagation") !== "true" && onClose();
15074
+ event.key === "Escape" && closeOnEscape2 && opened && event.target?.getAttribute("data-mantine-stop-propagation") !== "true" && onClose();
15075
15075
  },
15076
15076
  { capture: !0 }
15077
15077
  ), useFocusReturn({ opened, shouldReturnFocus: trapFocus && returnFocus }), {
@@ -15483,8 +15483,8 @@ const defaultProps$$ = {}, InputPlaceholder = factory((_props, ref) => {
15483
15483
  InputPlaceholder.classes = classes$k;
15484
15484
  InputPlaceholder.displayName = "@mantine/core/InputPlaceholder";
15485
15485
  function getInputOffsets(inputWrapperOrder, { hasDescription, hasError }) {
15486
- const inputIndex = inputWrapperOrder.findIndex((part) => part === "input"), aboveInput = inputWrapperOrder[inputIndex - 1], belowInput = inputWrapperOrder[inputIndex + 1];
15487
- return { offsetBottom: hasDescription && belowInput === "description" || hasError && belowInput === "error", offsetTop: hasDescription && aboveInput === "description" || hasError && aboveInput === "error" };
15486
+ const inputIndex = inputWrapperOrder.findIndex((part) => part === "input"), aboveInput = inputWrapperOrder.slice(0, inputIndex), belowInput = inputWrapperOrder.slice(inputIndex + 1), offsetTop = hasDescription && aboveInput.includes("description") || hasError && aboveInput.includes("error");
15487
+ return { offsetBottom: hasDescription && belowInput.includes("description") || hasError && belowInput.includes("error"), offsetTop };
15488
15488
  }
15489
15489
  const defaultProps$_ = {
15490
15490
  labelElement: "label",
@@ -16867,7 +16867,8 @@ function OptionsDropdown({
16867
16867
  unstyled,
16868
16868
  labelId,
16869
16869
  renderOption,
16870
- scrollAreaProps
16870
+ scrollAreaProps,
16871
+ "aria-label": ariaLabel
16871
16872
  }) {
16872
16873
  validateOptions(data);
16873
16874
  const filteredData = typeof search == "string" ? (filter2 || defaultOptionsFilter)({
@@ -16886,7 +16887,7 @@ function OptionsDropdown({
16886
16887
  },
16887
16888
  isOptionsGroup(item) ? item.group : item.value
16888
16889
  ));
16889
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Combobox.Dropdown, { hidden: hidden2 || hiddenWhenEmpty && isEmpty2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Combobox.Options, { labelledBy: labelId, children: [
16890
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Combobox.Dropdown, { hidden: hidden2 || hiddenWhenEmpty && isEmpty2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Combobox.Options, { labelledBy: labelId, "aria-label": ariaLabel, children: [
16890
16891
  withScrollArea ? /* @__PURE__ */ jsxRuntimeExports.jsx(
16891
16892
  ScrollArea.Autosize,
16892
16893
  {
@@ -18602,7 +18603,8 @@ const defaultProps$6 = {
18602
18603
  withCheckIcon,
18603
18604
  nothingFoundMessage,
18604
18605
  unstyled,
18605
- labelId: `${_id}-label`,
18606
+ labelId: others.label ? `${_id}-label` : void 0,
18607
+ "aria-label": others.label ? void 0 : others["aria-label"],
18606
18608
  renderOption,
18607
18609
  scrollAreaProps
18608
18610
  }
@@ -19750,7 +19752,9 @@ const theme = {
19750
19752
  })
19751
19753
  });
19752
19754
  function RadixTheme({ children: children2 }) {
19753
- const { colorScheme } = useMantineColorScheme(), computedScheme = useComputedColorScheme(), appearance = colorScheme === "auto" ? computedScheme : colorScheme;
19755
+ const { colorScheme } = useMantineColorScheme(), computedScheme = useComputedColorScheme(void 0, {
19756
+ getInitialValueInEffect: !1
19757
+ }), appearance = colorScheme === "auto" ? computedScheme : colorScheme;
19754
19758
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
19755
19759
  Theme,
19756
19760
  {
@@ -19768,7 +19772,7 @@ function RootComponent() {
19768
19772
  MantineProvider,
19769
19773
  {
19770
19774
  ...theme$1 && { forceColorScheme: theme$1 },
19771
- defaultColorScheme: "dark",
19775
+ defaultColorScheme: theme$1 ?? "dark",
19772
19776
  theme,
19773
19777
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadixTheme, { children: [
19774
19778
  /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollRestoration, {}),
@@ -29007,8 +29011,22 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
29007
29011
  }
29008
29012
  return newValues;
29009
29013
  }
29010
- function resolveVariantFromProps(props, definition, custom, currentValues = {}, currentVelocity = {}) {
29011
- return typeof definition == "function" && (definition = definition(custom !== void 0 ? custom : props.custom, currentValues, currentVelocity)), typeof definition == "string" && (definition = props.variants && props.variants[definition]), typeof definition == "function" && (definition = definition(custom !== void 0 ? custom : props.custom, currentValues, currentVelocity)), definition;
29014
+ function getValueState(visualElement) {
29015
+ const state = [{}, {}];
29016
+ return visualElement?.values.forEach((value, key) => {
29017
+ state[0][key] = value.get(), state[1][key] = value.getVelocity();
29018
+ }), state;
29019
+ }
29020
+ function resolveVariantFromProps(props, definition, custom, visualElement) {
29021
+ if (typeof definition == "function") {
29022
+ const [current, velocity] = getValueState(visualElement);
29023
+ definition = definition(custom !== void 0 ? custom : props.custom, current, velocity);
29024
+ }
29025
+ if (typeof definition == "string" && (definition = props.variants && props.variants[definition]), typeof definition == "function") {
29026
+ const [current, velocity] = getValueState(visualElement);
29027
+ definition = definition(custom !== void 0 ? custom : props.custom, current, velocity);
29028
+ }
29029
+ return definition;
29012
29030
  }
29013
29031
  function useConstant(init2) {
29014
29032
  const ref = reactExports.useRef(null);
@@ -29152,7 +29170,7 @@ function addHoverEvent(node, isActive) {
29152
29170
  const props = node.getProps();
29153
29171
  node.animationState && props.whileHover && node.animationState.setActive("whileHover", isActive);
29154
29172
  const callback = props[callbackName];
29155
- callback && callback(event, info);
29173
+ callback && frame.postRender(() => callback(event, info));
29156
29174
  };
29157
29175
  return addPointerEvent(node.current, eventName, handleEvent, {
29158
29176
  passive: !node.getProps()[callbackName]
@@ -29203,8 +29221,8 @@ class PressGesture extends Feature {
29203
29221
  const props = this.node.getProps(), removePointerUpListener = addPointerEvent(window, "pointerup", (endEvent, endInfo) => {
29204
29222
  if (!this.checkPressEnd())
29205
29223
  return;
29206
- const { onTap, onTapCancel, globalTapTarget } = this.node.getProps();
29207
- !globalTapTarget && !isNodeOrChild(this.node.current, endEvent.target) ? onTapCancel && onTapCancel(endEvent, endInfo) : onTap && onTap(endEvent, endInfo);
29224
+ const { onTap, onTapCancel, globalTapTarget } = this.node.getProps(), handler = !globalTapTarget && !isNodeOrChild(this.node.current, endEvent.target) ? onTapCancel : onTap;
29225
+ handler && frame.update(() => handler(endEvent, endInfo));
29208
29226
  }, {
29209
29227
  passive: !(props.onTap || props.onPointerUp)
29210
29228
  }), removePointerCancelListener = addPointerEvent(window, "pointercancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo), {
@@ -29218,7 +29236,7 @@ class PressGesture extends Feature {
29218
29236
  const handleKeyup = (keyupEvent) => {
29219
29237
  keyupEvent.key !== "Enter" || !this.checkPressEnd() || fireSyntheticPointerEvent("up", (event, info) => {
29220
29238
  const { onTap } = this.node.getProps();
29221
- onTap && onTap(event, info);
29239
+ onTap && frame.postRender(() => onTap(event, info));
29222
29240
  });
29223
29241
  };
29224
29242
  this.removeEndListeners(), this.removeEndListeners = addDomEvent(this.node.current, "keyup", handleKeyup), fireSyntheticPointerEvent("down", (event, info) => {
@@ -29233,7 +29251,7 @@ class PressGesture extends Feature {
29233
29251
  startPress(event, info) {
29234
29252
  this.isPressing = !0;
29235
29253
  const { onTapStart, whileTap } = this.node.getProps();
29236
- whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !0), onTapStart && onTapStart(event, info);
29254
+ whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !0), onTapStart && frame.postRender(() => onTapStart(event, info));
29237
29255
  }
29238
29256
  checkPressEnd() {
29239
29257
  return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !isDragActive();
@@ -29242,7 +29260,7 @@ class PressGesture extends Feature {
29242
29260
  if (!this.checkPressEnd())
29243
29261
  return;
29244
29262
  const { onTapCancel } = this.node.getProps();
29245
- onTapCancel && onTapCancel(event, info);
29263
+ onTapCancel && frame.postRender(() => onTapCancel(event, info));
29246
29264
  }
29247
29265
  mount() {
29248
29266
  const props = this.node.getProps(), removePointerListener = addPointerEvent(props.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, {
@@ -29336,17 +29354,9 @@ function shallowCompare(next, prev) {
29336
29354
  return !1;
29337
29355
  return !0;
29338
29356
  }
29339
- function getCurrent(visualElement) {
29340
- const current = {};
29341
- return visualElement.values.forEach((value, key) => current[key] = value.get()), current;
29342
- }
29343
- function getVelocity$1(visualElement) {
29344
- const velocity = {};
29345
- return visualElement.values.forEach((value, key) => velocity[key] = value.getVelocity()), velocity;
29346
- }
29347
29357
  function resolveVariant(visualElement, definition, custom) {
29348
29358
  const props = visualElement.getProps();
29349
- return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity$1(visualElement));
29359
+ return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, visualElement);
29350
29360
  }
29351
29361
  const secondsToMilliseconds = (seconds) => seconds * 1e3, millisecondsToSeconds = (milliseconds) => milliseconds / 1e3, underDampedSpring = {
29352
29362
  type: "spring",
@@ -29648,10 +29658,13 @@ function getAnimatableNone(key, value) {
29648
29658
  let defaultValueType = getDefaultValueType(key);
29649
29659
  return defaultValueType !== filter && (defaultValueType = complex), defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value) : void 0;
29650
29660
  }
29661
+ const invalidTemplates = /* @__PURE__ */ new Set(["auto", "none", "0"]);
29651
29662
  function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
29652
29663
  let i2 = 0, animatableTemplate;
29653
- for (; i2 < unresolvedKeyframes.length && !animatableTemplate; )
29654
- typeof unresolvedKeyframes[i2] == "string" && unresolvedKeyframes[i2] !== "none" && unresolvedKeyframes[i2] !== "0" && (animatableTemplate = unresolvedKeyframes[i2]), i2++;
29664
+ for (; i2 < unresolvedKeyframes.length && !animatableTemplate; ) {
29665
+ const keyframe = unresolvedKeyframes[i2];
29666
+ typeof keyframe == "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length && (animatableTemplate = unresolvedKeyframes[i2]), i2++;
29667
+ }
29655
29668
  if (animatableTemplate && name)
29656
29669
  for (const noneIndex of noneKeyframeIndexes)
29657
29670
  unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate);
@@ -29672,8 +29685,8 @@ class DOMKeyframesResolver extends KeyframeResolver {
29672
29685
  resolved !== void 0 && (unresolvedKeyframes[i2] = resolved), i2 === unresolvedKeyframes.length - 1 && (this.finalKeyframe = keyframe);
29673
29686
  }
29674
29687
  }
29675
- if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2)
29676
- return this.resolveNoneKeyframes();
29688
+ if (this.resolveNoneKeyframes(), !positionalKeys.has(name) || unresolvedKeyframes.length !== 2)
29689
+ return;
29677
29690
  const [origin, target] = unresolvedKeyframes, originType = findDimensionValueType(origin), targetType = findDimensionValueType(target);
29678
29691
  if (originType !== targetType)
29679
29692
  if (isNumOrPxType(originType) && isNumOrPxType(targetType))
@@ -29730,6 +29743,8 @@ function canAnimate(keyframes2, name, type, velocity) {
29730
29743
  const originKeyframe = keyframes2[0];
29731
29744
  if (originKeyframe === null)
29732
29745
  return !1;
29746
+ if (name === "display" || name === "visibility")
29747
+ return !0;
29733
29748
  const targetKeyframe = keyframes2[keyframes2.length - 1], isOriginAnimatable = isAnimatable(originKeyframe, name), isTargetAnimatable = isAnimatable(targetKeyframe, name);
29734
29749
  return !isOriginAnimatable || !isTargetAnimatable ? !1 : hasKeyframesChanged(keyframes2) || type === "spring" && velocity;
29735
29750
  }
@@ -30003,7 +30018,10 @@ function asRGBA(color2) {
30003
30018
  const mixColor = (from, to) => {
30004
30019
  const fromRGBA = asRGBA(from), toRGBA = asRGBA(to), blended = { ...fromRGBA };
30005
30020
  return (v2) => (blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v2), blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v2), blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v2), blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v2), rgba.transform(blended));
30006
- };
30021
+ }, invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
30022
+ function mixVisibility(origin, target) {
30023
+ return invisibleValues.has(origin) ? (p2) => p2 <= 0 ? origin : target : (p2) => p2 >= 1 ? target : origin;
30024
+ }
30007
30025
  function mixImmediate(a, b2) {
30008
30026
  return (p2) => p2 > 0 ? b2 : a;
30009
30027
  }
@@ -30042,7 +30060,7 @@ function matchOrder(origin, target) {
30042
30060
  }
30043
30061
  const mixComplex = (origin, target) => {
30044
30062
  const template = complex.createTransformer(target), originStats = analyseComplexValue(origin), targetStats = analyseComplexValue(target);
30045
- return originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length ? pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template) : mixImmediate(origin, target);
30063
+ return originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length ? invisibleValues.has(origin) && !targetStats.values.length || invisibleValues.has(target) && !originStats.values.length ? mixVisibility(origin, target) : pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template) : mixImmediate(origin, target);
30046
30064
  };
30047
30065
  function mix(from, to, p2) {
30048
30066
  return typeof from == "number" && typeof to == "number" && typeof p2 == "number" ? mixNumber$1(from, to, p2) : getMixer(from)(from, to);
@@ -30548,13 +30566,13 @@ class MotionValue {
30548
30566
  * @internal
30549
30567
  */
30550
30568
  constructor(init2, options = {}) {
30551
- this.version = "11.1.7", this.canTrackVelocity = !1, this.events = {}, this.updateAndNotify = (v2, render = !0) => {
30569
+ this.version = "11.2.4", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v2, render = !0) => {
30552
30570
  const currentTime = time.now();
30553
30571
  this.updatedAt !== currentTime && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(v2), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), render && this.events.renderRequest && this.events.renderRequest.notify(this.current);
30554
- }, this.hasAnimated = !1, this.setCurrent(init2), this.canTrackVelocity = isFloat(this.current), this.owner = options.owner;
30572
+ }, this.hasAnimated = !1, this.setCurrent(init2), this.owner = options.owner;
30555
30573
  }
30556
30574
  setCurrent(current) {
30557
- this.current = current, this.updatedAt = time.now();
30575
+ this.current = current, this.updatedAt = time.now(), this.canTrackVelocity === null && current !== void 0 && (this.canTrackVelocity = isFloat(this.current));
30558
30576
  }
30559
30577
  setPrevFrameValue(prevFrameValue = this.current) {
30560
30578
  this.prevFrameValue = prevFrameValue, this.prevUpdatedAt = this.updatedAt;
@@ -30770,7 +30788,7 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
30770
30788
  if (window.HandoffAppearAnimations) {
30771
30789
  const appearId = visualElement.getProps()[optimizedAppearDataAttribute];
30772
30790
  if (appearId) {
30773
- const elapsed = window.HandoffAppearAnimations(appearId, key);
30791
+ const elapsed = window.HandoffAppearAnimations(appearId, key, value, frame);
30774
30792
  elapsed !== null && (valueTransition.elapsed = elapsed, isHandoff = !0);
30775
30793
  }
30776
30794
  }
@@ -31272,7 +31290,7 @@ class VisualElementDragControls {
31272
31290
  }
31273
31291
  }
31274
31292
  this.originPoint[axis] = current;
31275
- }), onDragStart && onDragStart(event, info);
31293
+ }), onDragStart && frame.postRender(() => onDragStart(event, info));
31276
31294
  const { animationState } = this.visualElement;
31277
31295
  animationState && animationState.setActive("whileDrag", !0);
31278
31296
  }, onMove = (event, info) => {
@@ -31308,7 +31326,7 @@ class VisualElementDragControls {
31308
31326
  const { velocity } = info;
31309
31327
  this.startAnimation(velocity);
31310
31328
  const { onDragEnd } = this.getProps();
31311
- onDragEnd && onDragEnd(event, info);
31329
+ onDragEnd && frame.postRender(() => onDragEnd(event, info));
31312
31330
  }
31313
31331
  cancel() {
31314
31332
  this.isDragging = !1;
@@ -31490,7 +31508,7 @@ class DragGesture extends Feature {
31490
31508
  }
31491
31509
  }
31492
31510
  const asyncHandler = (handler) => (event, info) => {
31493
- handler && handler(event, info);
31511
+ handler && frame.postRender(() => handler(event, info));
31494
31512
  };
31495
31513
  class PanGesture extends Feature {
31496
31514
  constructor() {
@@ -31509,7 +31527,7 @@ class PanGesture extends Feature {
31509
31527
  onStart: asyncHandler(onPanStart),
31510
31528
  onMove: onPan,
31511
31529
  onEnd: (event, info) => {
31512
- delete this.session, onPanEnd && onPanEnd(event, info);
31530
+ delete this.session, onPanEnd && frame.postRender(() => onPanEnd(event, info));
31513
31531
  }
31514
31532
  };
31515
31533
  }
@@ -33233,7 +33251,9 @@ function toDomPrecision(v2) {
33233
33251
  return v2 === null ? 0.01 : Math.round(v2 * 100) / 100;
33234
33252
  }
33235
33253
  const isSameNode = (a) => (b2) => a.id === b2.id && a.type === b2.type && Object.is(a.parentId, b2.parentId), SyncWithDiagram = reactExports.memo(() => {
33236
- const xyflow = useXYFlow(), xyflowApi = useXYStoreApi(), diagramStoreApi = useDiagramStoreApi();
33254
+ const _xyflow = useXYFlow(), xyflowRef = reactExports.useRef(_xyflow);
33255
+ xyflowRef.current = _xyflow;
33256
+ const xyflowApi = useXYStoreApi(), diagramStoreApi = useDiagramStoreApi();
33237
33257
  return reactExports.useEffect(() => diagramStoreApi.subscribe(
33238
33258
  // selector
33239
33259
  (state) => ({
@@ -33246,7 +33266,7 @@ const isSameNode = (a) => (b2) => a.id === b2.id && a.type === b2.type && Object
33246
33266
  // listener
33247
33267
  ({ viewId, nodes, edges, ...opts }) => {
33248
33268
  const { lastOnNavigate } = diagramStoreApi.getState(), updates = diagramViewToXYFlowData({ nodes, edges }, opts);
33249
- if (xyflow.setNodes(
33269
+ if (xyflowRef.current.setNodes(
33250
33270
  (prev) => updates.nodes.map((update) => {
33251
33271
  const existing = prev.find(isSameNode(update));
33252
33272
  return existing ? deepEqual(existing.data.element, update.data.element) ? existing : {
@@ -33254,7 +33274,7 @@ const isSameNode = (a) => (b2) => a.id === b2.id && a.type === b2.type && Object
33254
33274
  ...update
33255
33275
  } : update;
33256
33276
  })
33257
- ), xyflow.setEdges(
33277
+ ), xyflowRef.current.setEdges(
33258
33278
  (prev) => updates.edges.map((update) => {
33259
33279
  const existing = prev.find((e2) => e2.id === update.id);
33260
33280
  return existing ? deepEqual(existing.data, update.data) ? existing : {
@@ -33267,22 +33287,20 @@ const isSameNode = (a) => (b2) => a.id === b2.id && a.type === b2.type && Object
33267
33287
  if (elTo) {
33268
33288
  const centerFrom = lastOnNavigate.elementCenterScreenPosition, nextZoom = Math.min(elFrom.width / elTo.width, elFrom.height / elTo.height);
33269
33289
  requestAnimationFrame(() => {
33270
- requestAnimationFrame(() => {
33271
- const v2 = xyflow.getViewport();
33272
- nextZoom < v2.zoom && xyflow.setViewport({
33273
- x: v2.x,
33274
- y: v2.y,
33275
- zoom: nextZoom
33276
- });
33277
- const centerTo = xyflow.flowToScreenPosition({
33278
- x: elTo.position[0] + elTo.width / 2,
33279
- y: elTo.position[1] + elTo.height / 2
33280
- }), diff = {
33281
- x: toDomPrecision(centerFrom.x - centerTo.x),
33282
- y: toDomPrecision(centerFrom.y - centerTo.y)
33283
- };
33284
- xyflowApi.getState().panBy(diff);
33290
+ const v2 = xyflowRef.current.getViewport();
33291
+ nextZoom < v2.zoom && xyflowRef.current.setViewport({
33292
+ x: v2.x,
33293
+ y: v2.y,
33294
+ zoom: nextZoom
33285
33295
  });
33296
+ const centerTo = xyflowRef.current.flowToScreenPosition({
33297
+ x: elTo.position[0] + elTo.width / 2,
33298
+ y: elTo.position[1] + elTo.height / 2
33299
+ }), diff = {
33300
+ x: toDomPrecision(centerFrom.x - centerTo.x),
33301
+ y: toDomPrecision(centerFrom.y - centerTo.y)
33302
+ };
33303
+ xyflowApi.getState().panBy(diff);
33286
33304
  });
33287
33305
  }
33288
33306
  diagramStoreApi.setState(
@@ -33300,7 +33318,7 @@ const isSameNode = (a) => (b2) => a.id === b2.id && a.type === b2.type && Object
33300
33318
  {
33301
33319
  equalityFn: shallowEqual
33302
33320
  }
33303
- ), [xyflow, xyflowApi, diagramStoreApi]), null;
33321
+ ), [xyflowApi, diagramStoreApi]), null;
33304
33322
  });
33305
33323
  function getVarName(variable) {
33306
33324
  var matches = variable.match(/^var\((.*)\)$/);
@@ -36644,7 +36662,7 @@ function Header({ diagram }) {
36644
36662
  /* @__PURE__ */ jsxRuntimeExports.jsx(ColorSchemeToggle, {}),
36645
36663
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { orientation: "vertical" }),
36646
36664
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { ml: "xs", size: isTablet ? "sm" : "xs", leftSection: /* @__PURE__ */ jsxRuntimeExports.jsx(IconShare, { size: 14 }), onClick: open, children: "Share" }),
36647
- /* @__PURE__ */ jsxRuntimeExports.jsx(ExportButton, {})
36665
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ExportButton, { diagram })
36648
36666
  ] }),
36649
36667
  /* @__PURE__ */ jsxRuntimeExports.jsx(
36650
36668
  ShareModal,
@@ -36753,10 +36771,27 @@ function ViewPageButton({
36753
36771
  ] })
36754
36772
  ] });
36755
36773
  }
36756
- function ExportButton() {
36774
+ function downloadImage(name, dataUrl) {
36775
+ const a = document.createElement("a");
36776
+ a.setAttribute("download", `${name}.png`), a.setAttribute("href", dataUrl), a.click();
36777
+ }
36778
+ function ExportButton({ diagram }) {
36757
36779
  const params = useParams({
36758
36780
  from: "/view/$viewId"
36759
- });
36781
+ }), onClick = async () => {
36782
+ const { toPng } = await import("./index-CgQjA8pD.js"), imageWidth = diagram.width + 32, imageHeight = diagram.height + 32;
36783
+ toPng(document.querySelector(".react-flow__viewport"), {
36784
+ backgroundColor: "transparent",
36785
+ width: imageWidth,
36786
+ height: imageHeight,
36787
+ cacheBust: !0,
36788
+ style: {
36789
+ width: imageWidth + "px",
36790
+ height: imageHeight + "px",
36791
+ transform: "translate(16px, 16px) scale(1)"
36792
+ }
36793
+ }).then((data) => downloadImage(diagram.id, data));
36794
+ };
36760
36795
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu, { shadow: "md", width: 200, trigger: "click-hover", openDelay: 200, children: [
36761
36796
  /* @__PURE__ */ jsxRuntimeExports.jsx(MenuTarget, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
36762
36797
  Button,
@@ -36771,7 +36806,7 @@ function ExportButton() {
36771
36806
  ) }),
36772
36807
  /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuDropdown, { children: [
36773
36808
  /* @__PURE__ */ jsxRuntimeExports.jsx(MenuLabel, { children: "Current view" }),
36774
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { children: "Export as .png" }),
36809
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { onClick, children: "Export as .png" }),
36775
36810
  /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { component: Link$1, to: "/view/$viewId/dot", search: !0, params, children: "Export as .dot" }),
36776
36811
  /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { component: Link$1, to: "/view/$viewId/d2", search: !0, params, children: "Export as .d2" }),
36777
36812
  /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { component: Link$1, to: "/view/$viewId/mmd", search: !0, params, children: "Export as .mmd" }),
@@ -37018,22 +37053,22 @@ const ViewViewIdReactLegacyLazyImport = createFileRoute(
37018
37053
  path: "/react-legacy",
37019
37054
  getParentRoute: () => ViewViewIdRoute
37020
37055
  }).lazy(
37021
- () => import("./view._viewId.react-legacy.lazy-CbH8iz1R.js").then((d2) => d2.Route)
37056
+ () => import("./view._viewId.react-legacy.lazy-D82hW8RW.js").then((d2) => d2.Route)
37022
37057
  ), ViewViewIdMmdLazyRoute = ViewViewIdMmdLazyImport.update({
37023
37058
  path: "/mmd",
37024
37059
  getParentRoute: () => ViewViewIdRoute
37025
37060
  }).lazy(
37026
- () => import("./view._viewId.mmd.lazy-BH_rg5NV.js").then((d2) => d2.Route)
37061
+ () => import("./view._viewId.mmd.lazy-CkKTxoM5.js").then((d2) => d2.Route)
37027
37062
  ), ViewViewIdDotLazyRoute = ViewViewIdDotLazyImport.update({
37028
37063
  path: "/dot",
37029
37064
  getParentRoute: () => ViewViewIdRoute
37030
37065
  }).lazy(
37031
- () => import("./view._viewId.dot.lazy-KvXSJdzM.js").then((d2) => d2.Route)
37066
+ () => import("./view._viewId.dot.lazy-DC6I8DnA.js").then((d2) => d2.Route)
37032
37067
  ), ViewViewIdD2LazyRoute = ViewViewIdD2LazyImport.update({
37033
37068
  path: "/d2",
37034
37069
  getParentRoute: () => ViewViewIdRoute
37035
37070
  }).lazy(
37036
- () => import("./view._viewId.d2.lazy-BRVYHRy1.js").then((d2) => d2.Route)
37071
+ () => import("./view._viewId.d2.lazy-DTd-VfOz.js").then((d2) => d2.Route)
37037
37072
  ), ViewViewIdEditorRoute = Route2.update({
37038
37073
  path: "/editor",
37039
37074
  getParentRoute: () => ViewViewIdRoute
@@ -1 +1 @@
1
- import "./main-C8jsNnb9.js";
1
+ import "./main-DDd-kcC2.js";