likec4 1.27.2 → 1.27.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.
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, memo as memo$2, useSyncExternalStore, createRef, useTransition as useTransition$1, useDeferredValue, use, StrictMode } from "react";
3
+ import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, memo as memo$2, useSyncExternalStore, createRef, useDeferredValue, use, StrictMode } from "react";
4
4
  import { createRoot } from "react-dom/client";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { createPortal, flushSync } from "react-dom";
7
- import { ComponentName, withOverviewGraph, isDevelopment, krokiD2SvgUrl, useHashHistory, basepath } from "./const.js";
7
+ import { ComponentName, useHashHistory, withOverviewGraph, isDevelopment, krokiD2SvgUrl, basepath } from "./const.js";
8
8
  import { projects, isSingleProject } from "likec4:projects";
9
9
  import { createLikeC4Model } from "likec4/model";
10
10
  import { invariant as invariant$2, hasAtLeast, nonexhaustive, isStepEdgeId, extractStep, DefaultShapeSize, DefaultTextSize, DefaultPaddingSize, compareNatural, DiagramNode, nameFromFqn, nonNullable, defaultTheme, ElementShapes, toArray, ifind, DefaultMap, ancestorsFqn, isScopedElementView, isDeploymentView, Queue, ElementKind, delay as delay$1, isAncestor, sortParentsFirst, ifilter, whereOperatorAsPredicate, getBBoxCenter, getParallelStepsPrefix, ComputedView, isDescendantOf } from "@likec4/core";
@@ -34023,38 +34023,28 @@ const useDiagramActorRef = () => {
34023
34023
  return ctx;
34024
34024
  };
34025
34025
  function useDiagram() {
34026
- const actor = useDiagramActorRef(), [, startTransition] = useTransition$1();
34026
+ const actor = useDiagramActorRef();
34027
34027
  return useMemo(() => ({
34028
34028
  actor,
34029
34029
  send: actor.send,
34030
34030
  navigateTo: (viewId, fromNode) => {
34031
- startTransition(() => {
34032
- actor.send({
34033
- type: "navigate.to",
34034
- viewId,
34035
- ...fromNode && { fromNode }
34036
- });
34031
+ actor.send({
34032
+ type: "navigate.to",
34033
+ viewId,
34034
+ ...fromNode && { fromNode }
34037
34035
  });
34038
34036
  },
34039
34037
  navigate: (direction) => {
34040
- startTransition(() => {
34041
- actor.send({ type: `navigate.${direction}` });
34042
- });
34038
+ actor.send({ type: `navigate.${direction}` });
34043
34039
  },
34044
34040
  fitDiagram: (duration = 350) => {
34045
- startTransition(() => {
34046
- actor.send({ type: "fitDiagram", duration });
34047
- });
34041
+ actor.send({ type: "fitDiagram", duration });
34048
34042
  },
34049
34043
  openRelationshipsBrowser: (fqn2) => {
34050
- startTransition(() => {
34051
- actor.send({ type: "open.relationshipsBrowser", fqn: fqn2 });
34052
- });
34044
+ actor.send({ type: "open.relationshipsBrowser", fqn: fqn2 });
34053
34045
  },
34054
34046
  openSource: (params) => {
34055
- startTransition(() => {
34056
- actor.send({ type: "open.source", ...params });
34057
- });
34047
+ actor.send({ type: "open.source", ...params });
34058
34048
  },
34059
34049
  openElementDetails: (fqn2, fromNode) => {
34060
34050
  actor.send({ type: "open.elementDetails", fqn: fqn2, fromNode });
@@ -35392,9 +35382,10 @@ function EdgeLabelContainer({
35392
35382
  children: /* @__PURE__ */ jsx(
35393
35383
  "div",
35394
35384
  {
35395
- className: css({
35385
+ style: {
35396
35386
  display: "contents"
35397
- }),
35387
+ },
35388
+ // Work around to keep same global selector data-likec4-dimmed
35398
35389
  ...isDimmed !== !1 && {
35399
35390
  "data-likec4-dimmed": isDimmed
35400
35391
  },
@@ -35718,17 +35709,19 @@ function ElementActionButtons({
35718
35709
  "data-likec4-hovered": isHovered,
35719
35710
  className: cx("nodrag nopan", actionButtons),
35720
35711
  children: buttons2.map((button2, index2) => /* @__PURE__ */ jsx(
35721
- m$2.div,
35712
+ ActionIcon$1,
35722
35713
  {
35714
+ component: m$2.button,
35715
+ layout: !0,
35716
+ className: actionBtn$1({}),
35723
35717
  initial: !1,
35724
35718
  whileTap: { scale: 1 },
35725
35719
  whileHover: {
35726
35720
  scale: 1.3
35727
35721
  },
35728
- onTap: (e2) => button2.onClick(e2),
35729
- onClick: stopPropagation$1,
35722
+ onClick: button2.onClick,
35730
35723
  onDoubleClick: stopPropagation$1,
35731
- children: /* @__PURE__ */ jsx(ActionIcon$1, { className: actionBtn$1({}), children: button2.icon })
35724
+ children: button2.icon
35732
35725
  },
35733
35726
  `action-button-${id2}-${button2.key ?? index2}`
35734
35727
  ))
@@ -38358,7 +38351,7 @@ function useRelationshipsBrowserState(selector3, compare = shallowEqual) {
38358
38351
  return xstateReact_cjsExports.useSelector(actor, useCallbackRef(selector3), compare);
38359
38352
  }
38360
38353
  function useRelationshipsBrowser() {
38361
- const actor = useRelationshipsBrowserActor(), [, startTransition] = useTransition$1();
38354
+ const actor = useRelationshipsBrowserActor();
38362
38355
  return useMemo(() => ({
38363
38356
  actor,
38364
38357
  get rootElementId() {
@@ -38379,12 +38372,10 @@ function useRelationshipsBrowser() {
38379
38372
  });
38380
38373
  },
38381
38374
  navigateTo: (subject, fromNode) => {
38382
- startTransition(() => {
38383
- actor.send({
38384
- type: "navigate.to",
38385
- subject,
38386
- fromNode
38387
- });
38375
+ actor.send({
38376
+ type: "navigate.to",
38377
+ subject,
38378
+ fromNode
38388
38379
  });
38389
38380
  },
38390
38381
  fitDiagram: () => {
@@ -40881,7 +40872,7 @@ const dagre = /* @__PURE__ */ getDefaultExportFromCjs(dagreExports), Sizes$2 = {
40881
40872
  edgesep: 25
40882
40873
  },
40883
40874
  edgeLabel: {
40884
- width: 120,
40875
+ width: 140,
40885
40876
  height: 10,
40886
40877
  minlen: 1,
40887
40878
  weight: 1
@@ -41073,7 +41064,7 @@ function layoutRelationshipsView$1(data, scope) {
41073
41064
  for (const edge of g.edges())
41074
41065
  g.setEdge(edge, {
41075
41066
  ...Sizes$2.edgeLabel,
41076
- width: edgeCount > 30 ? 800 : 400
41067
+ width: edgeCount > 25 ? 800 : 400
41077
41068
  });
41078
41069
  const dagreBounds = applyDagreLayout$2(g), _calculatedNodeBounds = C(
41079
41070
  nodeIds,
@@ -41163,8 +41154,6 @@ function layoutRelationshipsView$1(data, scope) {
41163
41154
  width,
41164
41155
  height
41165
41156
  },
41166
- inEdges: [],
41167
- outEdges: [],
41168
41157
  children: [],
41169
41158
  width,
41170
41159
  height,
@@ -41205,8 +41194,6 @@ function layoutRelationshipsView$1(data, scope) {
41205
41194
  ...element.$element.style
41206
41195
  },
41207
41196
  navigateTo,
41208
- inEdges: [],
41209
- outEdges: [],
41210
41197
  ...children2.length > 0 && { depth: nodeDepth(id2) },
41211
41198
  children: children2,
41212
41199
  width,
@@ -42402,7 +42389,7 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
42402
42389
  [backdropBlur]: "0px",
42403
42390
  [level]: "0",
42404
42391
  [offset]: "0px",
42405
- [inset]: "calc((1 + var(--_level) * 0.5) * var(--_offset))",
42392
+ [inset]: "calc((1 + var(--_level) * 0.75) * var(--_offset))",
42406
42393
  [backdropOpacity]: "0%",
42407
42394
  _backdrop: {
42408
42395
  cursor: "zoom-out",
@@ -42423,8 +42410,8 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
42423
42410
  height: "100vh"
42424
42411
  },
42425
42412
  sm: {
42426
- inset: "[var(--_inset) var(--_offset) var(--_offset) var(--_inset)]",
42427
- width: "calc(100vw - var(--_offset) - var(--_inset))",
42413
+ inset: "[var(--_inset) var(--_inset) var(--_offset) var(--_inset)]",
42414
+ width: "calc(100vw - 2 * var(--_inset))",
42428
42415
  height: "calc(100vh - var(--_offset) - var(--_inset))",
42429
42416
  [borderRadius]: "6px",
42430
42417
  padding: "6px",
@@ -42539,15 +42526,13 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
42539
42526
  [backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
42540
42527
  scale: 1,
42541
42528
  opacity: 1,
42542
- translateY: 0,
42543
42529
  transition: {
42544
42530
  delay: 0.075
42545
42531
  }
42546
42532
  },
42547
42533
  exit: {
42548
- scale: 1.3,
42534
+ scale: 1.2,
42549
42535
  opacity: 0,
42550
- translateY: -10,
42551
42536
  [backdropBlur]: "0px",
42552
42537
  [backdropOpacity]: "0%"
42553
42538
  }
@@ -43144,123 +43129,7 @@ const findRootSubject = (nodes) => nodes.find(
43144
43129
  // xyedges: [],
43145
43130
  // xynodes: [],
43146
43131
  // }),
43147
- }), finalize = (elements, explicits) => elements.size > 2 && explicits.size !== elements.size ? new Set(sortParentsFirst([
43148
- ...treeFromElements$1(elements).flatten(),
43149
- ...explicits
43150
- ])) : elements.size > 1 ? new Set(sortParentsFirst([...elements])) : elements;
43151
- function computeEdgeDetailsViewData(edges, view) {
43152
- const sources = /* @__PURE__ */ new Set(), relationships = /* @__PURE__ */ new Set(), targets = /* @__PURE__ */ new Set(), explicit = {
43153
- sources: /* @__PURE__ */ new Set(),
43154
- targets: /* @__PURE__ */ new Set()
43155
- }, addExplicit = (el, type) => {
43156
- type === "source" ? (sources.add(el), explicit.sources.add(el)) : (targets.add(el), explicit.targets.add(el));
43157
- };
43158
- for (const edgeId of edges) {
43159
- const edge = view.findEdge(edgeId), _relationships = edge ? [...edge.relationships("model")] : [];
43160
- if (!edge || !hasAtLeast(_relationships, 1) || !edge.source.hasElement() || !edge.target.hasElement())
43161
- continue;
43162
- const source = edge.source.element, target = edge.target.element;
43163
- addExplicit(source, "source"), addExplicit(target, "target");
43164
- for (const relationship of _relationships) {
43165
- if (relationships.add(relationship), relationship.source !== source) {
43166
- addExplicit(relationship.source, "source");
43167
- for (const parent of relationship.source.ancestors()) {
43168
- if (parent === source)
43169
- break;
43170
- sources.add(parent);
43171
- }
43172
- }
43173
- if (relationship.target !== target) {
43174
- addExplicit(relationship.target, "target");
43175
- for (const parent of relationship.target.ancestors()) {
43176
- if (parent === target)
43177
- break;
43178
- targets.add(parent);
43179
- }
43180
- }
43181
- }
43182
- }
43183
- return {
43184
- sources: finalize(sources, explicit.sources),
43185
- targets: finalize(targets, explicit.targets),
43186
- relationships
43187
- };
43188
- }
43189
- function computeRelationshipDetailsViewData({
43190
- // relationships: _relationships,
43191
- source,
43192
- target
43193
- }) {
43194
- const sources = /* @__PURE__ */ new Set(), relationships = /* @__PURE__ */ new Set(), targets = /* @__PURE__ */ new Set(), explicit = {
43195
- sources: /* @__PURE__ */ new Set(),
43196
- targets: /* @__PURE__ */ new Set()
43197
- }, addExplicit = (el, type) => {
43198
- type === "source" ? (sources.add(el), explicit.sources.add(el)) : (targets.add(el), explicit.targets.add(el));
43199
- };
43200
- source && addExplicit(source, "source"), target && addExplicit(target, "target");
43201
- const [connection] = modelConnection.findConnection(source, target, "directed");
43202
- if (!connection)
43203
- return {
43204
- sources,
43205
- targets,
43206
- relationships
43207
- };
43208
- for (const relationship of connection.relations) {
43209
- const relationSource = relationship.source, relationTarget = relationship.target;
43210
- if (addExplicit(relationSource, "source"), addExplicit(relationTarget, "target"), relationships.add(relationship), source !== relationSource) {
43211
- invariant$2(isAncestor(source, relationSource), `${source.id} is not an ancestor of ${relationSource.id}`);
43212
- for (const parent of relationSource.ancestors()) {
43213
- if (parent === source)
43214
- break;
43215
- sources.add(parent);
43216
- }
43217
- }
43218
- if (target !== relationTarget) {
43219
- invariant$2(isAncestor(target, relationTarget), `${target.id} is not an ancestor of ${relationTarget.id}`);
43220
- for (const parent of relationTarget.ancestors()) {
43221
- if (parent === target)
43222
- break;
43223
- targets.add(parent);
43224
- }
43225
- }
43226
- }
43227
- return {
43228
- sources: finalize(sources, explicit.sources),
43229
- targets: finalize(targets, explicit.targets),
43230
- relationships
43231
- };
43232
- }
43233
- const RelationshipDetailsActorContext = createContext(null);
43234
- function useRelationshipDetailsActor() {
43235
- return nonNullable(useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
43236
- }
43237
- function useRelationshipDetailsState(selector3, compare = shallowEqual) {
43238
- const select2 = useCallbackRef(selector3), actor = useRelationshipDetailsActor();
43239
- return xstateReact_cjsExports.useSelector(actor, select2, compare);
43240
- }
43241
- function useRelationshipDetails() {
43242
- const actor = useRelationshipDetailsActor(), [, startTransition] = useTransition$1();
43243
- return useMemo(() => ({
43244
- actor,
43245
- get rootElementId() {
43246
- return `relationship-details-${actor.sessionId.replaceAll(":", "_")}`;
43247
- },
43248
- getState: () => actor.getSnapshot().context,
43249
- send: actor.send,
43250
- navigateTo: (...params) => {
43251
- params.length === 1 ? actor.send({ type: "navigate.to", params: { edgeId: params[0] } }) : actor.send({ type: "navigate.to", params: { source: params[0], target: params[1] } });
43252
- },
43253
- fitDiagram: () => {
43254
- startTransition(() => {
43255
- actor.send({ type: "fitDiagram" });
43256
- });
43257
- },
43258
- close: () => {
43259
- actor._parent ? actor._parent?.send({ type: "close", actorId: actor.id }) : actor.send({ type: "close" });
43260
- }
43261
- }), [actor]);
43262
- }
43263
- const Sizes$1 = {
43132
+ }), Sizes$1 = {
43264
43133
  dagre: {
43265
43134
  ranksep: 60,
43266
43135
  nodesep: 35,
@@ -43800,12 +43669,7 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
43800
43669
  actions: [
43801
43670
  "updateLayoutData",
43802
43671
  xstate_cjsExports.cancel("fitDiagram"),
43803
- {
43804
- type: "xyflow:fitDiagram",
43805
- params: {
43806
- duration: 0
43807
- }
43808
- },
43672
+ xstate_cjsExports.raise({ type: "fitDiagram", duration: 0 }, { id: "fitDiagram", delay: 50 }),
43809
43673
  xstate_cjsExports.raise({ type: "xyflow.updateNodeInternals" }, { delay: 75 })
43810
43674
  ]
43811
43675
  },
@@ -44061,7 +43925,93 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
44061
43925
  "stopListeningToEsc",
44062
43926
  "closeAllOverlays"
44063
43927
  ]
44064
- }), RelationshipEdge = customEdge((props) => {
43928
+ }), finalize = (elements, explicits) => elements.size > 2 && explicits.size !== elements.size ? new Set(sortParentsFirst([
43929
+ ...treeFromElements$1(elements).flatten(),
43930
+ ...explicits
43931
+ ])) : elements.size > 1 ? new Set(sortParentsFirst([...elements])) : elements;
43932
+ function computeEdgeDetailsViewData(edges, view) {
43933
+ const sources = /* @__PURE__ */ new Set(), relationships = /* @__PURE__ */ new Set(), targets = /* @__PURE__ */ new Set(), explicit = {
43934
+ sources: /* @__PURE__ */ new Set(),
43935
+ targets: /* @__PURE__ */ new Set()
43936
+ }, addExplicit = (el, type) => {
43937
+ type === "source" ? (sources.add(el), explicit.sources.add(el)) : (targets.add(el), explicit.targets.add(el));
43938
+ };
43939
+ for (const edgeId of edges) {
43940
+ const edge = view.findEdge(edgeId), _relationships = edge ? [...edge.relationships("model")] : [];
43941
+ if (!edge || !hasAtLeast(_relationships, 1) || !edge.source.hasElement() || !edge.target.hasElement())
43942
+ continue;
43943
+ const source = edge.source.element, target = edge.target.element;
43944
+ addExplicit(source, "source"), addExplicit(target, "target");
43945
+ for (const relationship of _relationships) {
43946
+ if (relationships.add(relationship), relationship.source !== source) {
43947
+ addExplicit(relationship.source, "source");
43948
+ for (const parent of relationship.source.ancestors()) {
43949
+ if (parent === source)
43950
+ break;
43951
+ sources.add(parent);
43952
+ }
43953
+ }
43954
+ if (relationship.target !== target) {
43955
+ addExplicit(relationship.target, "target");
43956
+ for (const parent of relationship.target.ancestors()) {
43957
+ if (parent === target)
43958
+ break;
43959
+ targets.add(parent);
43960
+ }
43961
+ }
43962
+ }
43963
+ }
43964
+ return {
43965
+ sources: finalize(sources, explicit.sources),
43966
+ targets: finalize(targets, explicit.targets),
43967
+ relationships
43968
+ };
43969
+ }
43970
+ function computeRelationshipDetailsViewData({
43971
+ // relationships: _relationships,
43972
+ source,
43973
+ target
43974
+ }) {
43975
+ const sources = /* @__PURE__ */ new Set(), relationships = /* @__PURE__ */ new Set(), targets = /* @__PURE__ */ new Set(), explicit = {
43976
+ sources: /* @__PURE__ */ new Set(),
43977
+ targets: /* @__PURE__ */ new Set()
43978
+ }, addExplicit = (el, type) => {
43979
+ type === "source" ? (sources.add(el), explicit.sources.add(el)) : (targets.add(el), explicit.targets.add(el));
43980
+ };
43981
+ source && addExplicit(source, "source"), target && addExplicit(target, "target");
43982
+ const [connection] = modelConnection.findConnection(source, target, "directed");
43983
+ if (!connection)
43984
+ return {
43985
+ sources,
43986
+ targets,
43987
+ relationships
43988
+ };
43989
+ for (const relationship of connection.relations) {
43990
+ const relationSource = relationship.source, relationTarget = relationship.target;
43991
+ if (addExplicit(relationSource, "source"), addExplicit(relationTarget, "target"), relationships.add(relationship), source !== relationSource) {
43992
+ invariant$2(isAncestor(source, relationSource), `${source.id} is not an ancestor of ${relationSource.id}`);
43993
+ for (const parent of relationSource.ancestors()) {
43994
+ if (parent === source)
43995
+ break;
43996
+ sources.add(parent);
43997
+ }
43998
+ }
43999
+ if (target !== relationTarget) {
44000
+ invariant$2(isAncestor(target, relationTarget), `${target.id} is not an ancestor of ${relationTarget.id}`);
44001
+ for (const parent of relationTarget.ancestors()) {
44002
+ if (parent === target)
44003
+ break;
44004
+ targets.add(parent);
44005
+ }
44006
+ }
44007
+ }
44008
+ return {
44009
+ sources: finalize(sources, explicit.sources),
44010
+ targets: finalize(targets, explicit.targets),
44011
+ relationships
44012
+ };
44013
+ }
44014
+ const RelationshipEdge = customEdge((props) => {
44065
44015
  const { enableNavigateTo } = useEnabledFeature("NavigateTo"), {
44066
44016
  sourceX,
44067
44017
  targetY,
@@ -44195,7 +44145,35 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
44195
44145
  },
44196
44146
  id2
44197
44147
  ))
44198
- ] }), edgeEnpoint = css.raw({
44148
+ ] }), RelationshipDetailsActorContext = createContext(null);
44149
+ function useRelationshipDetailsActor() {
44150
+ return nonNullable(useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
44151
+ }
44152
+ function useRelationshipDetailsState(selector3, compare = shallowEqual) {
44153
+ const select2 = useCallbackRef(selector3), actor = useRelationshipDetailsActor();
44154
+ return xstateReact_cjsExports.useSelector(actor, select2, compare);
44155
+ }
44156
+ function useRelationshipDetails() {
44157
+ const actor = useRelationshipDetailsActor();
44158
+ return useMemo(() => ({
44159
+ actor,
44160
+ get rootElementId() {
44161
+ return `relationship-details-${actor.sessionId.replaceAll(":", "_")}`;
44162
+ },
44163
+ getState: () => actor.getSnapshot().context,
44164
+ send: actor.send,
44165
+ navigateTo: (...params) => {
44166
+ params.length === 1 ? actor.send({ type: "navigate.to", params: { edgeId: params[0] } }) : actor.send({ type: "navigate.to", params: { source: params[0], target: params[1] } });
44167
+ },
44168
+ fitDiagram: () => {
44169
+ actor.send({ type: "fitDiagram" });
44170
+ },
44171
+ close: () => {
44172
+ actor._parent ? actor._parent?.send({ type: "close", actorId: actor.id }) : actor.send({ type: "close" });
44173
+ }
44174
+ }), [actor]);
44175
+ }
44176
+ const edgeEnpoint = css.raw({
44199
44177
  display: "inline-flex",
44200
44178
  alignItems: "center",
44201
44179
  padding: "6px 2px 0 2px",
@@ -47107,13 +47085,13 @@ const selectXYProps = (ctx) => ({
47107
47085
  onCanvasClick,
47108
47086
  onCanvasDblClick
47109
47087
  } = useDiagramEventHandlers(), notReadOnly = !enableReadOnly, isReducedGraphics = useIsReducedGraphics(), layoutConstraints = useLayoutConstraints(), $isPanning = usePanningAtom(), isPanning = useTimeout(() => {
47110
- $isPanning.get() || $isPanning.set(!0);
47111
- }, isReducedGraphics ? 150 : 350), notPanning = useDebouncedCallback$1(() => {
47088
+ $isPanning.set(!0);
47089
+ }, isReducedGraphics ? 100 : 200), notPanning = useDebouncedCallback$1(() => {
47112
47090
  isPanning.clear(), $isPanning.get() && $isPanning.set(!1);
47113
- }, 120), onMove = useCallbackRef((event) => {
47091
+ }, 200), onMove = useCallbackRef((event) => {
47114
47092
  event && ($isPanning.get() || isPanning.start(), notPanning());
47115
47093
  }), onMoveEnd = useCallbackRef((event, viewport) => {
47116
- notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
47094
+ event && notPanning.flush(), diagram.send({ type: "xyflow.viewportMoved", viewport, manually: !!event });
47117
47095
  }), onViewportResize = useCallbackRef(() => {
47118
47096
  diagram.send({ type: "xyflow.resized" });
47119
47097
  });
@@ -49759,17 +49737,17 @@ const AlertLocalhost = () => /* @__PURE__ */ jsx(
49759
49737
  children: copied ? "Copied" : "Copy to clipboard"
49760
49738
  }
49761
49739
  ), EmbedPanel = ({ diagram }) => {
49762
- const router = useRouter(), { colorScheme } = useMantineColorScheme(), [theme2, setTheme] = useState(colorScheme), padding = 20, url = new URL(
49763
- router.buildLocation({
49764
- to: "/embed/$viewId",
49765
- params: { viewId: diagram.id },
49766
- search: {
49767
- padding,
49768
- theme: theme2 !== "auto" ? theme2 : void 0
49769
- }
49770
- }).href,
49771
- window.location.href
49772
- ), width = diagram.bounds.width + padding * 2, height = diagram.bounds.height + padding * 2, href = url.href, code = `
49740
+ const router = useRouter(), { colorScheme } = useMantineColorScheme(), [theme2, setTheme] = useState(colorScheme), padding = 20;
49741
+ let location = router.buildLocation({
49742
+ to: "/embed/$viewId",
49743
+ params: { viewId: diagram.id },
49744
+ search: {
49745
+ padding,
49746
+ theme: theme2 !== "auto" ? theme2 : void 0
49747
+ }
49748
+ }).href;
49749
+ location = useHashHistory ? `#${location}` : location;
49750
+ const url = new URL(location, window.location.href), width = diagram.bounds.width + padding * 2, height = diagram.bounds.height + padding * 2, href = url.href, code = `
49773
49751
  <div style="aspect-ratio:${width}/${height};width:100%;height:auto;max-width:${width}px;margin:0 auto">
49774
49752
  <iframe src="${href}" width="100%" height="100%" style="border:0;background:transparent;"></iframe>
49775
49753
  </div>