likec4 1.59.3 → 1.60.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.
Files changed (99) hide show
  1. package/__app__/codegen/react.mjs +6 -6
  2. package/__app__/codegen/webcomponent.mjs +147 -69
  3. package/__app__/src/aichat/index.mjs +10 -5
  4. package/__app__/src/chunks/AIChat.mjs +1134 -693
  5. package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
  6. package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
  7. package/__app__/src/chunks/es.mjs +515 -335
  8. package/__app__/src/chunks/hooks.mjs +578 -366
  9. package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
  10. package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
  11. package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
  12. package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
  13. package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
  14. package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
  15. package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
  16. package/__app__/src/chunks/libs/d3.mjs +3218 -1509
  17. package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
  18. package/__app__/src/chunks/libs/framer.mjs +9251 -3846
  19. package/__app__/src/chunks/libs/nanostores.mjs +174 -0
  20. package/__app__/src/chunks/libs/zod.mjs +4591 -2363
  21. package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
  22. package/__app__/src/chunks/styled-system.mjs +3538 -756
  23. package/__app__/src/fonts.css +112 -1
  24. package/__app__/src/main.mjs +44398 -24039
  25. package/__app__/src/style.css +18488 -1
  26. package/config/schema.json +136 -97
  27. package/dist/app/render-view-client.css +1 -1
  28. package/dist/app/render-view-client.js +506 -338
  29. package/dist/chunks/enableServer.mjs +1 -1
  30. package/dist/chunks/filenames.mjs +16 -14
  31. package/dist/chunks/generate-likec4.mjs +5 -0
  32. package/dist/chunks/index.d.mts +246 -180
  33. package/dist/chunks/index2.d.mts +2882 -1977
  34. package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
  35. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
  36. package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
  37. package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
  38. package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
  39. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
  40. package/dist/chunks/libs/birpc.mjs +1 -1
  41. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  42. package/dist/chunks/libs/chevrotain.mjs +87 -35
  43. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  44. package/dist/chunks/libs/json5.mjs +4 -4
  45. package/dist/chunks/libs/langium.d.mts +9903 -5297
  46. package/dist/chunks/libs/langium.mjs +16 -24
  47. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  48. package/dist/chunks/libs/p-limit.mjs +1 -0
  49. package/dist/chunks/libs/p-queue.mjs +1 -1
  50. package/dist/chunks/libs/package-manager-detector.mjs +1 -1
  51. package/dist/chunks/libs/pako.mjs +2 -2
  52. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  53. package/dist/chunks/libs/remeda.mjs +1 -1
  54. package/dist/chunks/libs/ufo.mjs +1 -1
  55. package/dist/chunks/libs/unstorage.mjs +1 -1
  56. package/dist/chunks/libs/which.mjs +1 -1
  57. package/dist/chunks/node.mjs +60 -60
  58. package/dist/chunks/rolldown-runtime.mjs +1 -1
  59. package/dist/chunks/sequence-view.mjs +1 -1
  60. package/dist/chunks/vite-plugin.mjs +55 -52
  61. package/dist/cli/index.d.mts +1 -1
  62. package/dist/cli/index.mjs +208 -1300
  63. package/dist/config/index.d.mts +2 -2
  64. package/dist/generators/likec4.d.mts +6578 -0
  65. package/dist/generators/likec4.mjs +1 -0
  66. package/dist/index.d.mts +3 -3
  67. package/dist/model/index.d.mts +8 -5
  68. package/dist/vite-plugin/index.d.mts +6 -3
  69. package/dist/vite-plugin/index.mjs +1 -1
  70. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
  71. package/dist/vite-plugin/internal/index.d.mts +16 -15
  72. package/dist/vite-plugin/internal/index.mjs +144 -46
  73. package/generators/likec4/package.json +4 -0
  74. package/package.json +117 -110
  75. package/react/index.d.mts +8500 -5399
  76. package/react/index.mjs +534 -58617
  77. package/react/rolldown-runtime-DnkiqaRY.js +1 -0
  78. package/skills/likec4-dsl/SKILL.md +428 -0
  79. package/skills/likec4-dsl/evals/evals-public.json +202 -0
  80. package/skills/likec4-dsl/evals/grading-spec.json +589 -0
  81. package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
  82. package/skills/likec4-dsl/references/cli.md +139 -0
  83. package/skills/likec4-dsl/references/configuration.md +266 -0
  84. package/skills/likec4-dsl/references/deployment.md +160 -0
  85. package/skills/likec4-dsl/references/dynamic-views.md +455 -0
  86. package/skills/likec4-dsl/references/examples.md +370 -0
  87. package/skills/likec4-dsl/references/identifier-validity.md +90 -0
  88. package/skills/likec4-dsl/references/include-predicates-wildcards.md +179 -0
  89. package/skills/likec4-dsl/references/model.md +151 -0
  90. package/skills/likec4-dsl/references/predicates.md +123 -0
  91. package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
  92. package/skills/likec4-dsl/references/specification.md +75 -0
  93. package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
  94. package/skills/likec4-dsl/references/troubleshooting.md +96 -0
  95. package/skills/likec4-dsl/references/views.md +329 -0
  96. package/vite-plugin-modules.d.ts +4 -2
  97. package/dist/chunks/libs/picomatch.mjs +0 -1
  98. package/dist/chunks/libs/zod.d.mts +0 -2140
  99. package/dist/chunks/libs/zod.mjs +0 -65
@@ -1,84 +1,90 @@
1
1
  import "./rolldown-runtime.mjs";
2
- import { D as e, j as t } from "./hooks.mjs";
3
- import { A as n, D as r, F as i, H as a, L as o, O as s, R as c, a as l, at as u, c as d, d as f, f as p, h as m, l as h, m as g, n as _, o as v, p as y, pt as b, s as x, t as S, tt as C, u as w, x as T, z as E } from "./LikeC4Styles.mjs";
4
- import { on as ee } from "./libs/@mantine.mjs";
5
- import { M as te } from "./styled-system.mjs";
6
- import { C as ne, c as re, d as ie, g as ae, u as oe } from "./libs/@xyflow/react.mjs";
7
- import { n as D } from "./libs/fast-equals.mjs";
8
- import { _ as O, g as k, o as A, p as j, v as M, y as N } from "./libs/framer.mjs";
9
- import { a as P, i as F, l as I, n as L, r as R, t as z } from "./libs/@xstate/react.mjs";
10
- import { createContext as B, memo as V, useContext as H, useEffect as U, useRef as W } from "react";
11
- import { c as G } from "react/compiler-runtime";
12
- import { jsx as K, jsxs as q } from "react/jsx-runtime";
13
- import { invariant as se, nonNullable as J, nonexhaustive as ce } from "@likec4/core";
14
- import { useLikeC4ProjectsOverview as le } from "likec4:projects-overview";
2
+ import { O as t, w as useSyncedRef } from "./hooks.mjs";
3
+ import { $ as useCallbackRef, D as EnsureMantine, E as FramerMotionConfig, F as Base, P as BaseXYFlow, R as bezierPath, a as ElementNodeContainer, b as useId$1, c as EdgePath, d as EdgeContainer, f as Logo$1, ht as t$1, i as ElementShape, k as RootContainer, l as EdgeLabelContainer, m as useChangeLikeC4Project, n as DefaultHandles, nt as MinZoom, o as ElementData, p as LogoIcon, r as memoEdge, rt as ZIndexes, s as ElementActionButtons, st as IconZoomScan, t as LikeC4Styles, u as EdgeLabel } from "./LikeC4Styles.mjs";
4
+ import { fn as useCallbackRef$1 } from "./libs/@mantine.mjs";
5
+ import { A as createStyleContext, I as cx, M as isCssProperty, t as navigationPanel } from "./styled-system.mjs";
6
+ import { C as getViewportForBounds, c as ReactFlowProvider, d as applyNodeChanges, g as useStoreApi, u as applyEdgeChanges } from "./libs/@xyflow/react.mjs";
7
+ import { n as shallowEqual } from "./libs/fast-equals.mjs";
8
+ import { _ as stagger, d as isValidMotionProp, g as mapValue, i as m, o as animate, p as LayoutGroup, v as styleEffect, y as motionValue } from "./libs/framer.mjs";
9
+ import { a as emit, i as setup, l as assign, n as useSelector, r as assertEvent, t as useActorRef } from "./libs/@xstate/react.mjs";
10
+ import { createContext, forwardRef, memo, useContext, useEffect, useRef } from "react";
11
+ import { c } from "react/compiler-runtime";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { invariant, nonNullable, nonexhaustive } from "@likec4/core";
14
+ import { useLikeC4ProjectsOverview } from "likec4:projects-overview";
15
15
  //#region ../diagram/src/projects-overview/layouted-to-xyflow.ts
16
- function layoutedProjectsViewToXYFlow(e) {
16
+ function layoutedProjectsViewToXYFlow(view) {
17
17
  return {
18
- xynodes: t(e.nodes, projectNodeToXY),
19
- xyedges: t(e.edges, projectEdgeToXY)
18
+ xynodes: t(view.nodes, projectNodeToXY),
19
+ xyedges: t(view.edges, projectEdgeToXY)
20
20
  };
21
21
  }
22
- function projectNodeToXY({ id: e, x: t, y: n, width: r, height: i, ...a }) {
22
+ function projectNodeToXY({ id, x, y, width, height, ...node }) {
23
23
  return {
24
- id: e,
24
+ id,
25
25
  position: {
26
- x: t,
27
- y: n
26
+ x,
27
+ y
28
28
  },
29
29
  type: "project",
30
- initialWidth: r,
31
- initialHeight: i,
32
- draggable: !1,
33
- deletable: !1,
34
- zIndex: c.Element,
30
+ initialWidth: width,
31
+ initialHeight: height,
32
+ draggable: false,
33
+ deletable: false,
34
+ zIndex: ZIndexes.Element,
35
35
  style: {
36
- width: r,
37
- height: i
36
+ width,
37
+ height
38
38
  },
39
39
  data: {
40
- id: e,
41
- width: r,
42
- height: i,
43
- ...a
40
+ id,
41
+ width,
42
+ height,
43
+ ...node
44
44
  }
45
45
  };
46
46
  }
47
- function projectEdgeToXY({ id: e, source: t, target: n, ...r }) {
47
+ function projectEdgeToXY({ id, source, target, ...edge }) {
48
48
  return {
49
- id: e,
50
- source: t,
51
- target: n,
49
+ id,
50
+ source,
51
+ target,
52
52
  type: "relationship",
53
- zIndex: c.Edge,
54
- deletable: !1,
53
+ zIndex: ZIndexes.Edge,
54
+ deletable: false,
55
55
  data: {
56
- id: e,
56
+ id,
57
57
  technology: null,
58
58
  labelBBox: null,
59
- ...r
59
+ ...edge
60
60
  }
61
61
  };
62
62
  }
63
63
  //#endregion
64
64
  //#region ../diagram/src/projects-overview/persistence.ts
65
- var Y = "likec4:projects-overview:lastViewport", X = {
65
+ var key = `likec4:projects-overview:lastViewport`;
66
+ var ProjectsOverviewViewportPersistence = {
66
67
  read() {
67
68
  try {
68
- let e = sessionStorage.getItem(Y);
69
- return e ? JSON.parse(e) : null;
69
+ let fromStorage = sessionStorage.getItem(key);
70
+ if (fromStorage) return JSON.parse(fromStorage);
71
+ return null;
70
72
  } catch (e) {
71
- return console.error(`Error reading fromStorage ${Y}:`, e), null;
73
+ console.error(`Error reading fromStorage ${key}:`, e);
74
+ return null;
72
75
  }
73
76
  },
74
- write(e) {
75
- if (!e) {
76
- sessionStorage.removeItem(Y);
77
+ write(viewport) {
78
+ if (!viewport) {
79
+ sessionStorage.removeItem(key);
77
80
  return;
78
81
  }
79
- sessionStorage.setItem(Y, JSON.stringify(e));
82
+ sessionStorage.setItem(key, JSON.stringify(viewport));
80
83
  }
81
- }, Z = F({
84
+ };
85
+ //#endregion
86
+ //#region ../diagram/src/projects-overview/actor.ts
87
+ var machine = setup({
82
88
  types: {
83
89
  context: {},
84
90
  tags: "",
@@ -87,93 +93,132 @@ var Y = "likec4:projects-overview:lastViewport", X = {
87
93
  emitted: {}
88
94
  },
89
95
  guards: {
90
- isReady: ({ context: e }) => e.initialized.xydata && e.initialized.xyflow && !!e.xystore && !!e.xyflow,
91
- "click: selected node": ({ event: e }) => e.type === "xyflow.click.node" && e.node.selected === !0
96
+ isReady: ({ context }) => context.initialized.xydata && context.initialized.xyflow && !!context.xystore && !!context.xyflow,
97
+ "click: selected node": ({ event }) => {
98
+ return event.type === "xyflow.click.node" && event.node.selected === true;
99
+ }
92
100
  }
93
- }), updateView = () => Z.assign(({ event: e }) => {
94
- R(e, "update.view");
95
- let { xynodes: t, xyedges: n } = layoutedProjectsViewToXYFlow(e.view);
101
+ });
102
+ var updateView = () => machine.assign(({ event }) => {
103
+ assertEvent(event, "update.view");
104
+ const { xynodes, xyedges } = layoutedProjectsViewToXYFlow(event.view);
96
105
  return {
97
- view: e.view,
98
- xynodes: t,
99
- xyedges: n
106
+ view: event.view,
107
+ xynodes,
108
+ xyedges
100
109
  };
101
- }), xyflowApplyNodeChanges = () => Z.assign(({ context: e, event: t }) => (R(t, "xyflow.applyNodeChanges"), { xynodes: ie(t.changes, e.xynodes) })), xyflowApplyEdgeChanges = () => Z.assign(({ context: e, event: t }) => (R(t, "xyflow.applyEdgeChanges"), { xyedges: oe(t.changes, e.xyedges) })), onMouseEnterOrLeave = () => Z.assign(({ context: e, event: t }) => {
102
- R(t, [
110
+ });
111
+ var xyflowApplyNodeChanges = () => machine.assign(({ context, event }) => {
112
+ assertEvent(event, "xyflow.applyNodeChanges");
113
+ return { xynodes: applyNodeChanges(event.changes, context.xynodes) };
114
+ });
115
+ var xyflowApplyEdgeChanges = () => machine.assign(({ context, event }) => {
116
+ assertEvent(event, "xyflow.applyEdgeChanges");
117
+ return { xyedges: applyEdgeChanges(event.changes, context.xyedges) };
118
+ });
119
+ var onMouseEnterOrLeave = () => machine.assign(({ context, event }) => {
120
+ assertEvent(event, [
103
121
  "xyflow.mouse.enter.edge",
104
122
  "xyflow.mouse.leave.edge",
105
123
  "xyflow.mouse.enter.node",
106
124
  "xyflow.mouse.leave.node"
107
125
  ]);
108
- let n = t.type.startsWith("xyflow.mouse.enter");
109
- switch (t.type) {
126
+ const isEnter = event.type.startsWith("xyflow.mouse.enter");
127
+ switch (event.type) {
110
128
  case "xyflow.mouse.enter.edge":
111
129
  case "xyflow.mouse.leave.edge": {
112
- let r = t.edge.id;
113
- return { xyedges: e.xyedges.map((e) => e.id === r ? E.setHovered(e, n) : e) };
130
+ const edgeId = event.edge.id;
131
+ return { xyedges: context.xyedges.map((e) => {
132
+ if (e.id === edgeId) return Base.setHovered(e, isEnter);
133
+ return e;
134
+ }) };
114
135
  }
115
136
  case "xyflow.mouse.enter.node":
116
137
  case "xyflow.mouse.leave.node": {
117
- let r = t.node.id;
118
- return { xynodes: e.xynodes.map((e) => e.id === r ? E.setHovered(e, n) : e) };
138
+ const nodeId = event.node.id;
139
+ return { xynodes: context.xynodes.map((n) => {
140
+ if (n.id === nodeId) return Base.setHovered(n, isEnter);
141
+ return n;
142
+ }) };
119
143
  }
120
- default: ce(t);
144
+ default: nonexhaustive(event);
121
145
  }
122
- }), saveViewport = () => Z.createAction(({ context: e }) => {
123
- let t = e.xyflow;
124
- t && X.write(t.getViewport());
125
- }), handleClick = () => Z.enqueueActions(({ event: e, enqueue: t }) => {
126
- if (e.type === "xyflow.click.double") {
127
- t(fitDiagram());
146
+ });
147
+ var saveViewport = () => machine.createAction(({ context }) => {
148
+ const xyflow = context.xyflow;
149
+ if (xyflow) ProjectsOverviewViewportPersistence.write(xyflow.getViewport());
150
+ });
151
+ var handleClick = () => machine.enqueueActions(({ event, enqueue }) => {
152
+ if (event.type === "xyflow.click.double") {
153
+ enqueue(fitDiagram());
128
154
  return;
129
155
  }
130
- }), fitDiagram = (e) => Z.enqueueActions(({ context: t, event: n }) => {
131
- let r = t.view.bounds, i;
132
- e ? (r = e.bounds ?? t.view.bounds, i = e.duration) : n.type === "xyflow.fitDiagram" && (r = n.bounds ?? t.view.bounds, i = n.duration), i ??= 450;
133
- let { width: a, height: s, panZoom: c, transform: l } = J(t.xystore).getState(), u = Math.max(1, l[2]), d = ne(r, a, s, o, u, t.fitViewPadding);
134
- d.x = Math.round(d.x), d.y = Math.round(d.y);
135
- let f = i > 0 ? {
136
- duration: i,
156
+ });
157
+ var fitDiagram = (params) => machine.enqueueActions(({ context, event }) => {
158
+ let bounds = context.view.bounds;
159
+ let duration;
160
+ if (params) {
161
+ bounds = params.bounds ?? context.view.bounds;
162
+ duration = params.duration;
163
+ } else if (event.type === "xyflow.fitDiagram") {
164
+ bounds = event.bounds ?? context.view.bounds;
165
+ duration = event.duration;
166
+ }
167
+ duration ??= 450;
168
+ const { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
169
+ const maxZoom = Math.max(1, transform[2]);
170
+ const viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, context.fitViewPadding);
171
+ viewport.x = Math.round(viewport.x);
172
+ viewport.y = Math.round(viewport.y);
173
+ const animationProps = duration > 0 ? {
174
+ duration,
137
175
  interpolate: "smooth"
138
176
  } : void 0;
139
- c?.setViewport(d, f).catch((e) => {
140
- console.error("Error during fitDiagram panZoom setViewport", { err: e });
141
- }), X.write(null);
142
- }), restoreViewport = () => Z.enqueueActions(({ context: e, enqueue: t }) => {
143
- let n = X.read();
144
- if (n) {
145
- J(e.xyflow).setViewport(n, { duration: 0 });
177
+ panZoom?.setViewport(viewport, animationProps).catch((err) => {
178
+ console.error("Error during fitDiagram panZoom setViewport", { err });
179
+ });
180
+ ProjectsOverviewViewportPersistence.write(null);
181
+ });
182
+ var restoreViewport = () => machine.enqueueActions(({ context, enqueue }) => {
183
+ const viewport = ProjectsOverviewViewportPersistence.read();
184
+ if (viewport) {
185
+ nonNullable(context.xyflow).setViewport(viewport, { duration: 0 });
146
186
  return;
147
187
  }
148
- t(fitDiagram({ duration: 0 }));
149
- }), dispose = () => Z.assign({
188
+ enqueue(fitDiagram({ duration: 0 }));
189
+ });
190
+ var dispose = () => machine.assign({
150
191
  xyflow: null,
151
192
  xystore: null,
152
193
  initialized: {
153
- xyflow: !1,
154
- xydata: !1
194
+ xyflow: false,
195
+ xydata: false
155
196
  },
156
197
  xyedges: [],
157
198
  xynodes: []
158
- }), assignNavigateTo = () => Z.assign(({ event: e, context: t }) => {
159
- let n;
160
- switch (e.type) {
199
+ });
200
+ var assignNavigateTo = () => machine.assign(({ event, context }) => {
201
+ let navigateTo;
202
+ switch (event.type) {
161
203
  case "xyflow.click.node":
162
- n = e.node;
204
+ navigateTo = event.node;
163
205
  break;
164
206
  case "navigate.to":
165
- n = J(t.xynodes.find((t) => t.id === e.fromNode), `Node ${e.fromNode} not found`);
207
+ navigateTo = nonNullable(context.xynodes.find((n) => n.id === event.fromNode), `Node ${event.fromNode} not found`);
166
208
  break;
167
- default: return console.warn(`Unexpected event ${e.type} in assignNavigateTo`), {};
209
+ default:
210
+ console.warn(`Unexpected event ${event.type} in assignNavigateTo`);
211
+ return {};
168
212
  }
169
- return { navigateTo: n };
170
- }), ue = Z.createMachine({
213
+ return { navigateTo };
214
+ });
215
+ var projectOverviewLogic = machine.createMachine({
171
216
  id: "projects-overview",
172
- context: ({ input: e }) => ({
173
- ...e,
217
+ context: ({ input }) => ({
218
+ ...input,
174
219
  initialized: {
175
- xydata: !1,
176
- xyflow: !1
220
+ xydata: false,
221
+ xyflow: false
177
222
  },
178
223
  xyflow: null,
179
224
  xystore: null,
@@ -181,24 +226,24 @@ var Y = "likec4:projects-overview:lastViewport", X = {
181
226
  xyedges: []
182
227
  }),
183
228
  initial: "init",
184
- on: { close: { target: ".closed" } },
229
+ on: { "close": { target: ".closed" } },
185
230
  states: {
186
231
  init: { on: {
187
232
  "update.view": {
188
- actions: [updateView(), I(({ context: e }) => ({ initialized: {
189
- ...e.initialized,
190
- xydata: !0
233
+ actions: [updateView(), assign(({ context }) => ({ initialized: {
234
+ ...context.initialized,
235
+ xydata: true
191
236
  } }))],
192
237
  target: "isReady"
193
238
  },
194
239
  "xyflow.init": {
195
- actions: [I(({ context: e, event: t }) => ({
240
+ actions: [assign(({ context, event }) => ({
196
241
  initialized: {
197
- ...e.initialized,
198
- xyflow: !0
242
+ ...context.initialized,
243
+ xyflow: true
199
244
  },
200
- xyflow: t.xyflow,
201
- xystore: t.xystore
245
+ xyflow: event.xyflow,
246
+ xystore: event.xystore
202
247
  }))],
203
248
  target: "isReady"
204
249
  }
@@ -231,39 +276,53 @@ var Y = "likec4:projects-overview:lastViewport", X = {
231
276
  tags: "active",
232
277
  entry: [
233
278
  saveViewport(),
234
- I({ xyedges: [] }),
235
- ({ context: { navigateTo: e, xyflow: t, xystore: n }, self: r }) => {
236
- se(t && e, "Invalid state, xyflow is undefined");
237
- let { width: i, domNode: a } = J(n).getState(), s = b(Math.min(i * 7 / 9 / e.data.width), {
238
- min: o,
279
+ assign({ xyedges: [] }),
280
+ ({ context: { navigateTo, xyflow, xystore }, self }) => {
281
+ invariant(xyflow && navigateTo, "Invalid state, xyflow is undefined");
282
+ const { width, domNode } = nonNullable(xystore).getState();
283
+ const nextZoom = t$1(Math.min(width * 7 / 9 / navigateTo.data.width), {
284
+ min: MinZoom,
239
285
  max: 2.5
240
- }), c = {
241
- x: Math.round(-s * e.position.x + (i - s * e.data.width) / 2),
242
- y: Math.round(-s * e.position.y) + 50
243
- }, l = t.getViewport(), u = a.querySelectorAll(`.react-flow__node-project:not([data-id="${e.id}"]) > *`), d = A(u, {
286
+ });
287
+ const next = {
288
+ x: Math.round(-nextZoom * navigateTo.position.x + (width - nextZoom * navigateTo.data.width) / 2),
289
+ y: Math.round(-nextZoom * navigateTo.position.y) + 50
290
+ };
291
+ const current = xyflow.getViewport();
292
+ const otherNodes = domNode.querySelectorAll(`.react-flow__node-project:not([data-id="${navigateTo.id}"]) > *`);
293
+ const otherNodesAnimation = animate(otherNodes, {
244
294
  opacity: 0,
245
295
  scale: .9
246
296
  }, {
247
297
  visualDuration: .25,
248
- delay: O(.08, { from: "center" })
249
- }), f = N(1), p = k(f, [1, 0], [`translate(${l.x}px, ${l.y}px) scale(${l.zoom})`, `translate(${c.x}px, ${c.y}px) scale(${s})`]), m = M(a.querySelector(".xyflow__viewport"), { transform: p }), h = M(a.querySelector(`.react-flow__node-project:is([data-id="${e.id}"]) > *`), { opacity: f }), g = A(f, 0, {
250
- delay: u.length > 3 ? .25 : 0,
298
+ delay: stagger(.08, { from: "center" })
299
+ });
300
+ const v = motionValue(1);
301
+ const transform = mapValue(v, [1, 0], [`translate(${current.x}px, ${current.y}px) scale(${current.zoom})`, `translate(${next.x}px, ${next.y}px) scale(${nextZoom})`]);
302
+ const cancelViewportAnimation = styleEffect(domNode.querySelector(".xyflow__viewport"), { transform });
303
+ const cancelOpacityAnimation = styleEffect(domNode.querySelector(`.react-flow__node-project:is([data-id="${navigateTo.id}"]) > *`), { opacity: v });
304
+ const targetAnimation = animate(v, 0, {
305
+ delay: otherNodes.length > 3 ? .25 : 0,
251
306
  type: "spring",
252
307
  stiffness: 350,
253
308
  damping: 40,
254
309
  mass: 1.5,
255
310
  visualDuration: .55
256
311
  });
257
- Promise.race([g.finished, sleep(750)]).then(() => {
258
- m(), h(), g.stop(), d.stop(), r.send({
312
+ Promise.race([targetAnimation.finished, sleep(750)]).then(() => {
313
+ cancelViewportAnimation();
314
+ cancelOpacityAnimation();
315
+ targetAnimation.stop();
316
+ otherNodesAnimation.stop();
317
+ self.send({
259
318
  type: "emit.navigate.to",
260
- projectId: e.data.projectId
319
+ projectId: navigateTo.data.projectId
261
320
  });
262
321
  });
263
322
  }
264
323
  ],
265
- on: { "emit.navigate.to": { actions: P(({ event: e }) => ({
266
- ...e,
324
+ on: { "emit.navigate.to": { actions: emit(({ event }) => ({
325
+ ...event,
267
326
  type: "navigate.to"
268
327
  })) } }
269
328
  },
@@ -274,264 +333,495 @@ var Y = "likec4:projects-overview:lastViewport", X = {
274
333
  }
275
334
  }
276
335
  });
277
- function sleep(e) {
278
- return new Promise((t) => setTimeout(t, e));
336
+ function sleep(ms) {
337
+ return new Promise((resolve) => setTimeout(resolve, ms));
279
338
  }
280
339
  //#endregion
281
340
  //#region ../diagram/src/projects-overview/context.ts
282
- var Q = B(null), de = Q.Provider;
341
+ var ProjectsOverviewActorContext = createContext(null);
342
+ var ProjectsOverviewActorContextProvider = ProjectsOverviewActorContext.Provider;
283
343
  function useProjectsOverviewActor() {
284
- let e = G(2), t = H(Q), n;
285
- return e[0] === t ? n = e[1] : (n = J(t, "No ProjectsOverviewActorContext"), e[0] = t, e[1] = n), n;
344
+ const $ = c(2);
345
+ const t0 = useContext(ProjectsOverviewActorContext);
346
+ let t1;
347
+ if ($[0] !== t0) {
348
+ t1 = nonNullable(t0, "No ProjectsOverviewActorContext");
349
+ $[0] = t0;
350
+ $[1] = t1;
351
+ } else t1 = $[1];
352
+ return t1;
286
353
  }
287
354
  //#endregion
355
+ //#region ../diagram/src/components/NavigationPanel.tsx
356
+ var { withProvider, withContext } = createStyleContext(navigationPanel);
357
+ var shouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && (isValidMotionProp(prop) || !isCssProperty(prop));
358
+ var LogoButton = forwardRef((t0, ref) => {
359
+ const $ = c(11);
360
+ let className;
361
+ let props;
362
+ if ($[0] !== t0) {
363
+ ({className, ...props} = t0);
364
+ $[0] = t0;
365
+ $[1] = className;
366
+ $[2] = props;
367
+ } else {
368
+ className = $[1];
369
+ props = $[2];
370
+ }
371
+ let t1;
372
+ if ($[3] !== className) {
373
+ t1 = cx("mantine-active", className);
374
+ $[3] = className;
375
+ $[4] = t1;
376
+ } else t1 = $[4];
377
+ let t2;
378
+ let t3;
379
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
380
+ t2 = /* @__PURE__ */ jsx(LogoIcon, { "data-logo-icon": true });
381
+ t3 = /* @__PURE__ */ jsx(Logo$1, { "data-logo-full": true });
382
+ $[5] = t2;
383
+ $[6] = t3;
384
+ } else {
385
+ t2 = $[5];
386
+ t3 = $[6];
387
+ }
388
+ let t4;
389
+ if ($[7] !== props || $[8] !== ref || $[9] !== t1) {
390
+ t4 = /* @__PURE__ */ jsxs("button", {
391
+ ...props,
392
+ ref,
393
+ className: t1,
394
+ children: [t2, t3]
395
+ });
396
+ $[7] = props;
397
+ $[8] = ref;
398
+ $[9] = t1;
399
+ $[10] = t4;
400
+ } else t4 = $[10];
401
+ return t4;
402
+ });
403
+ var NavigationPanel = {
404
+ Root: withProvider(m.div, "root", { shouldForwardProp }),
405
+ Body: withContext(m.div, "body", { shouldForwardProp }),
406
+ Logo: withContext(LogoButton, "logo", { shouldForwardProp }),
407
+ Label: withContext(m.div, "label", { shouldForwardProp }),
408
+ Dropdown: withContext(m.div, "dropdown", { shouldForwardProp })
409
+ };
410
+ //#endregion
288
411
  //#region ../diagram/src/projects-overview/panel/ProjectsOverviewPanel.tsx
289
412
  var ProjectsOverviewPanel = () => {
290
- let e = G(1), t;
291
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ K(_.Root, { children: /* @__PURE__ */ q(_.Body, { children: [/* @__PURE__ */ K(_.Logo, {}), /* @__PURE__ */ K(_.Label, { children: "Projects Overview" })] }) }), e[0] = t) : t = e[0], t;
292
- }, fe = v((e) => {
293
- let t = a(e.data.points);
294
- return /* @__PURE__ */ q(g, {
295
- ...e,
296
- children: [/* @__PURE__ */ K(f, {
297
- edgeProps: e,
298
- svgPath: t
299
- }), /* @__PURE__ */ K(p, {
300
- edgeProps: e,
301
- children: /* @__PURE__ */ K(y, { edgeProps: e })
413
+ const $ = c(1);
414
+ let t0;
415
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
416
+ t0 = /* @__PURE__ */ jsx(NavigationPanel.Root, { children: /* @__PURE__ */ jsxs(NavigationPanel.Body, { children: [/* @__PURE__ */ jsx(NavigationPanel.Logo, {}), /* @__PURE__ */ jsx(NavigationPanel.Label, { children: "Projects Overview" })] }) });
417
+ $[0] = t0;
418
+ } else t0 = $[0];
419
+ return t0;
420
+ };
421
+ //#endregion
422
+ //#region ../diagram/src/projects-overview/custom/edgeTypes.tsx
423
+ var RelationshipEdge = memoEdge((edgeProps) => {
424
+ const path = bezierPath(edgeProps.data.points);
425
+ return /* @__PURE__ */ jsxs(EdgeContainer, {
426
+ ...edgeProps,
427
+ children: [/* @__PURE__ */ jsx(EdgePath, {
428
+ edgeProps,
429
+ svgPath: path
430
+ }), /* @__PURE__ */ jsx(EdgeLabelContainer, {
431
+ edgeProps,
432
+ children: /* @__PURE__ */ jsx(EdgeLabel, { edgeProps })
302
433
  })]
303
434
  });
304
435
  });
305
436
  //#endregion
306
437
  //#region ../diagram/src/projects-overview/custom/nodeTypes.tsx
307
- function ProjectNode(e) {
308
- let t = G(19), n = useProjectsOverviewActor(), t0;
309
- t[0] !== n || t[1] !== e.data.id || t[2] !== e.data.projectId ? (t0 = (t) => {
310
- t.stopPropagation(), n.send({
311
- type: "navigate.to",
312
- fromNode: e.data.id,
313
- projectId: e.data.projectId
438
+ function ProjectNode(props) {
439
+ const $ = c(19);
440
+ const actor = useProjectsOverviewActor();
441
+ let t0;
442
+ if ($[0] !== actor || $[1] !== props.data.id || $[2] !== props.data.projectId) {
443
+ t0 = (e) => {
444
+ e.stopPropagation();
445
+ actor.send({
446
+ type: "navigate.to",
447
+ fromNode: props.data.id,
448
+ projectId: props.data.projectId
449
+ });
450
+ };
451
+ $[0] = actor;
452
+ $[1] = props.data.id;
453
+ $[2] = props.data.projectId;
454
+ $[3] = t0;
455
+ } else t0 = $[3];
456
+ const navigateTo = useCallbackRef$1(t0);
457
+ let t1;
458
+ let t2;
459
+ if ($[4] !== props) {
460
+ t1 = /* @__PURE__ */ jsx(ElementShape, { ...props });
461
+ t2 = /* @__PURE__ */ jsx(ElementData, { ...props });
462
+ $[4] = props;
463
+ $[5] = t1;
464
+ $[6] = t2;
465
+ } else {
466
+ t1 = $[5];
467
+ t2 = $[6];
468
+ }
469
+ let t3;
470
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
471
+ t3 = /* @__PURE__ */ jsx(IconZoomScan, {});
472
+ $[7] = t3;
473
+ } else t3 = $[7];
474
+ let t4;
475
+ if ($[8] !== navigateTo) {
476
+ t4 = [{
477
+ key: "navigate",
478
+ icon: t3,
479
+ onClick: navigateTo
480
+ }];
481
+ $[8] = navigateTo;
482
+ $[9] = t4;
483
+ } else t4 = $[9];
484
+ let t5;
485
+ if ($[10] !== props || $[11] !== t4) {
486
+ t5 = /* @__PURE__ */ jsx(ElementActionButtons, {
487
+ ...props,
488
+ buttons: t4
314
489
  });
315
- }, t[0] = n, t[1] = e.data.id, t[2] = e.data.projectId, t[3] = t0) : t0 = t[3];
316
- let r = ee(t0), i, a;
317
- t[4] === e ? (i = t[5], a = t[6]) : (i = /* @__PURE__ */ K(x, { ...e }), a = /* @__PURE__ */ K(h, { ...e }), t[4] = e, t[5] = i, t[6] = a);
318
- let o;
319
- t[7] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ K(u, {}), t[7] = o) : o = t[7];
320
- let s;
321
- t[8] === r ? s = t[9] : (s = [{
322
- key: "navigate",
323
- icon: o,
324
- onClick: r
325
- }], t[8] = r, t[9] = s);
326
- let c;
327
- t[10] !== e || t[11] !== s ? (c = /* @__PURE__ */ K(w, {
328
- ...e,
329
- buttons: s
330
- }), t[10] = e, t[11] = s, t[12] = c) : c = t[12];
331
- let f;
332
- t[13] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ K(l, {}), t[13] = f) : f = t[13];
333
- let p;
334
- return t[14] !== e || t[15] !== i || t[16] !== a || t[17] !== c ? (p = /* @__PURE__ */ q(d, {
335
- layout: !0,
336
- nodeProps: e,
337
- children: [
338
- i,
339
- a,
340
- c,
341
- f
342
- ]
343
- }, e.id), t[14] = e, t[15] = i, t[16] = a, t[17] = c, t[18] = p) : p = t[18], p;
490
+ $[10] = props;
491
+ $[11] = t4;
492
+ $[12] = t5;
493
+ } else t5 = $[12];
494
+ let t6;
495
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
496
+ t6 = /* @__PURE__ */ jsx(DefaultHandles, {});
497
+ $[13] = t6;
498
+ } else t6 = $[13];
499
+ let t7;
500
+ if ($[14] !== props || $[15] !== t1 || $[16] !== t2 || $[17] !== t5) {
501
+ t7 = /* @__PURE__ */ jsxs(ElementNodeContainer, {
502
+ layout: true,
503
+ nodeProps: props,
504
+ children: [
505
+ t1,
506
+ t2,
507
+ t5,
508
+ t6
509
+ ]
510
+ }, props.id);
511
+ $[14] = props;
512
+ $[15] = t1;
513
+ $[16] = t2;
514
+ $[17] = t5;
515
+ $[18] = t7;
516
+ } else t7 = $[18];
517
+ return t7;
344
518
  }
345
519
  //#endregion
346
520
  //#region ../diagram/src/projects-overview/hooks.ts
347
- function useProjectsOverviewState(e, t) {
348
- let n = t === void 0 ? D : t, r = useProjectsOverviewActor();
349
- return L(r, e, n);
521
+ function useProjectsOverviewState(selector, t0) {
522
+ const compare = t0 === void 0 ? shallowEqual : t0;
523
+ const actor = useProjectsOverviewActor();
524
+ return useSelector(actor, selector, compare);
350
525
  }
351
526
  function useProjectsOverviewXYStoreApi() {
352
- return ae();
527
+ return useStoreApi();
353
528
  }
354
529
  //#endregion
355
530
  //#region ../diagram/src/projects-overview/ProjectsOverviewXY.tsx
356
- var pe = { project: ProjectNode }, me = { relationship: fe }, selector = (e) => ({
357
- isActive: e.hasTag("active"),
358
- nodes: e.context.xynodes,
359
- edges: e.context.xyedges
360
- }), selectorEq = (e, t) => e.isActive === t.isActive && D(e.nodes, t.nodes) && D(e.edges, t.edges), $ = V((e) => {
361
- let t = G(45), n, r;
362
- t[0] === e ? (n = t[1], r = t[2]) : ({background: r, ...n} = e, t[0] = e, t[1] = n, t[2] = r);
363
- let a = r === void 0 ? "dots" : r, o = useProjectsOverviewActor(), { isActive: s, nodes: c, edges: l } = useProjectsOverviewState(selector, selectorEq), u = useProjectsOverviewXYStoreApi(), d = s ? "initialized" : "not-initialized", f;
364
- t[3] === d ? f = t[4] : (f = te(d, "projects-overview"), t[3] = d, t[4] = f);
531
+ var nodeTypes = { project: ProjectNode };
532
+ var edgeTypes = { relationship: RelationshipEdge };
533
+ var selector = (state) => ({
534
+ isActive: state.hasTag("active"),
535
+ nodes: state.context.xynodes,
536
+ edges: state.context.xyedges
537
+ });
538
+ var selectorEq = (a, b) => a.isActive === b.isActive && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges);
539
+ var ProjectsOverviewXY = memo((t0) => {
540
+ const $ = c(45);
541
+ let props;
542
+ let t1;
543
+ if ($[0] !== t0) {
544
+ ({background: t1, ...props} = t0);
545
+ $[0] = t0;
546
+ $[1] = props;
547
+ $[2] = t1;
548
+ } else {
549
+ props = $[1];
550
+ t1 = $[2];
551
+ }
552
+ const background = t1 === void 0 ? "dots" : t1;
553
+ const actorRef = useProjectsOverviewActor();
554
+ const { isActive, nodes, edges } = useProjectsOverviewState(selector, selectorEq);
555
+ const xystore = useProjectsOverviewXYStoreApi();
556
+ const t2 = isActive ? "initialized" : "not-initialized";
557
+ let t3;
558
+ if ($[3] !== t2) {
559
+ t3 = cx(t2, "projects-overview");
560
+ $[3] = t2;
561
+ $[4] = t3;
562
+ } else t3 = $[4];
365
563
  let t4;
366
- t[5] === o ? t4 = t[6] : (t4 = (e, t) => {
367
- e.stopPropagation(), o.send({
368
- type: "xyflow.click.node",
369
- node: t
370
- });
371
- }, t[5] = o, t[6] = t4);
372
- let p = C(t4), t6;
373
- t[7] === o ? t6 = t[8] : (t6 = (e, t) => {
374
- e.stopPropagation(), o.send({
375
- type: "xyflow.click.edge",
376
- edge: t
377
- });
378
- }, t[7] = o, t[8] = t6);
379
- let m = C(t6), t8;
380
- t[9] === o ? t8 = t[10] : (t8 = (e) => {
381
- e.stopPropagation(), o.send({ type: "xyflow.click.pane" });
382
- }, t[9] = o, t[10] = t8);
383
- let h = C(t8), t10;
384
- t[11] === o ? t10 = t[12] : (t10 = (e) => {
385
- e.stopPropagation(), o.send({ type: "xyflow.click.double" });
386
- }, t[11] = o, t[12] = t10);
387
- let g = C(t10), t12;
388
- t[13] === o ? t12 = t[14] : (t12 = (e) => {
389
- o.send({
390
- type: "xyflow.applyNodeChanges",
391
- changes: e
392
- });
393
- }, t[13] = o, t[14] = t12);
394
- let _ = C(t12), t14;
395
- t[15] === o ? t14 = t[16] : (t14 = (e) => {
396
- o.send({
397
- type: "xyflow.applyEdgeChanges",
398
- changes: e
399
- });
400
- }, t[15] = o, t[16] = t14);
401
- let v = C(t14), t16;
402
- t[17] === o ? t16 = t[18] : (t16 = (e, t) => {
403
- o.send({
404
- type: "xyflow.mouse.enter.edge",
405
- edge: t,
406
- event: e
407
- });
408
- }, t[17] = o, t[18] = t16);
409
- let y = C(t16), t18;
410
- t[19] === o ? t18 = t[20] : (t18 = (e, t) => {
411
- o.send({
412
- type: "xyflow.mouse.leave.edge",
413
- edge: t,
414
- event: e
415
- });
416
- }, t[19] = o, t[20] = t18);
417
- let b = C(t18), t20;
418
- t[21] === o ? t20 = t[22] : (t20 = (e, t) => {
419
- o.send({
420
- type: "xyflow.mouse.enter.node",
421
- node: t
422
- });
423
- }, t[21] = o, t[22] = t20);
424
- let x = C(t20), t22;
425
- t[23] === o ? t22 = t[24] : (t22 = (e, t) => {
426
- o.send({
427
- type: "xyflow.mouse.leave.node",
428
- node: t
429
- });
430
- }, t[23] = o, t[24] = t22);
431
- let S = C(t22), t24;
432
- t[25] !== o || t[26] !== u ? (t24 = (e) => {
433
- o.send({
434
- type: "xyflow.init",
435
- xyflow: e,
436
- xystore: u
564
+ if ($[5] !== actorRef) {
565
+ t4 = (_e, node) => {
566
+ _e.stopPropagation();
567
+ actorRef.send({
568
+ type: "xyflow.click.node",
569
+ node
570
+ });
571
+ };
572
+ $[5] = actorRef;
573
+ $[6] = t4;
574
+ } else t4 = $[6];
575
+ const t5 = useCallbackRef(t4);
576
+ let t6;
577
+ if ($[7] !== actorRef) {
578
+ t6 = (_e_0, edge) => {
579
+ _e_0.stopPropagation();
580
+ actorRef.send({
581
+ type: "xyflow.click.edge",
582
+ edge
583
+ });
584
+ };
585
+ $[7] = actorRef;
586
+ $[8] = t6;
587
+ } else t6 = $[8];
588
+ const t7 = useCallbackRef(t6);
589
+ let t8;
590
+ if ($[9] !== actorRef) {
591
+ t8 = (_e_1) => {
592
+ _e_1.stopPropagation();
593
+ actorRef.send({ type: "xyflow.click.pane" });
594
+ };
595
+ $[9] = actorRef;
596
+ $[10] = t8;
597
+ } else t8 = $[10];
598
+ const t9 = useCallbackRef(t8);
599
+ let t10;
600
+ if ($[11] !== actorRef) {
601
+ t10 = (_e_2) => {
602
+ _e_2.stopPropagation();
603
+ actorRef.send({ type: "xyflow.click.double" });
604
+ };
605
+ $[11] = actorRef;
606
+ $[12] = t10;
607
+ } else t10 = $[12];
608
+ const t11 = useCallbackRef(t10);
609
+ let t12;
610
+ if ($[13] !== actorRef) {
611
+ t12 = (changes) => {
612
+ actorRef.send({
613
+ type: "xyflow.applyNodeChanges",
614
+ changes
615
+ });
616
+ };
617
+ $[13] = actorRef;
618
+ $[14] = t12;
619
+ } else t12 = $[14];
620
+ const t13 = useCallbackRef(t12);
621
+ let t14;
622
+ if ($[15] !== actorRef) {
623
+ t14 = (changes_0) => {
624
+ actorRef.send({
625
+ type: "xyflow.applyEdgeChanges",
626
+ changes: changes_0
627
+ });
628
+ };
629
+ $[15] = actorRef;
630
+ $[16] = t14;
631
+ } else t14 = $[16];
632
+ const t15 = useCallbackRef(t14);
633
+ let t16;
634
+ if ($[17] !== actorRef) {
635
+ t16 = (event, edge_0) => {
636
+ actorRef.send({
637
+ type: "xyflow.mouse.enter.edge",
638
+ edge: edge_0,
639
+ event
640
+ });
641
+ };
642
+ $[17] = actorRef;
643
+ $[18] = t16;
644
+ } else t16 = $[18];
645
+ const t17 = useCallbackRef(t16);
646
+ let t18;
647
+ if ($[19] !== actorRef) {
648
+ t18 = (event_0, edge_1) => {
649
+ actorRef.send({
650
+ type: "xyflow.mouse.leave.edge",
651
+ edge: edge_1,
652
+ event: event_0
653
+ });
654
+ };
655
+ $[19] = actorRef;
656
+ $[20] = t18;
657
+ } else t18 = $[20];
658
+ const t19 = useCallbackRef(t18);
659
+ let t20;
660
+ if ($[21] !== actorRef) {
661
+ t20 = (event_1, node_0) => {
662
+ actorRef.send({
663
+ type: "xyflow.mouse.enter.node",
664
+ node: node_0
665
+ });
666
+ };
667
+ $[21] = actorRef;
668
+ $[22] = t20;
669
+ } else t20 = $[22];
670
+ const t21 = useCallbackRef(t20);
671
+ let t22;
672
+ if ($[23] !== actorRef) {
673
+ t22 = (event_2, node_1) => {
674
+ actorRef.send({
675
+ type: "xyflow.mouse.leave.node",
676
+ node: node_1
677
+ });
678
+ };
679
+ $[23] = actorRef;
680
+ $[24] = t22;
681
+ } else t22 = $[24];
682
+ const t23 = useCallbackRef(t22);
683
+ let t24;
684
+ if ($[25] !== actorRef || $[26] !== xystore) {
685
+ t24 = (xyflow) => {
686
+ actorRef.send({
687
+ type: "xyflow.init",
688
+ xyflow,
689
+ xystore
690
+ });
691
+ };
692
+ $[25] = actorRef;
693
+ $[26] = xystore;
694
+ $[27] = t24;
695
+ } else t24 = $[27];
696
+ const t25 = useCallbackRef(t24);
697
+ let t26;
698
+ if ($[28] !== background || $[29] !== edges || $[30] !== nodes || $[31] !== props || $[32] !== t11 || $[33] !== t13 || $[34] !== t15 || $[35] !== t17 || $[36] !== t19 || $[37] !== t21 || $[38] !== t23 || $[39] !== t25 || $[40] !== t3 || $[41] !== t5 || $[42] !== t7 || $[43] !== t9) {
699
+ t26 = /* @__PURE__ */ jsx(BaseXYFlow, {
700
+ nodes,
701
+ edges,
702
+ className: t3,
703
+ nodeTypes,
704
+ edgeTypes,
705
+ fitView: false,
706
+ onNodeClick: t5,
707
+ onEdgeClick: t7,
708
+ onPaneClick: t9,
709
+ onDoubleClick: t11,
710
+ onNodesChange: t13,
711
+ onEdgesChange: t15,
712
+ onEdgeMouseEnter: t17,
713
+ onEdgeMouseLeave: t19,
714
+ onNodeMouseEnter: t21,
715
+ onNodeMouseLeave: t23,
716
+ onInit: t25,
717
+ nodesDraggable: false,
718
+ nodesSelectable: true,
719
+ pannable: true,
720
+ zoomable: true,
721
+ background,
722
+ ...props
437
723
  });
438
- }, t[25] = o, t[26] = u, t[27] = t24) : t24 = t[27];
439
- let w = C(t24), T;
440
- return t[28] !== a || t[29] !== l || t[30] !== c || t[31] !== n || t[32] !== g || t[33] !== _ || t[34] !== v || t[35] !== y || t[36] !== b || t[37] !== x || t[38] !== S || t[39] !== w || t[40] !== f || t[41] !== p || t[42] !== m || t[43] !== h ? (T = /* @__PURE__ */ K(i, {
441
- nodes: c,
442
- edges: l,
443
- className: f,
444
- nodeTypes: pe,
445
- edgeTypes: me,
446
- fitView: !1,
447
- onNodeClick: p,
448
- onEdgeClick: m,
449
- onPaneClick: h,
450
- onDoubleClick: g,
451
- onNodesChange: _,
452
- onEdgesChange: v,
453
- onEdgeMouseEnter: y,
454
- onEdgeMouseLeave: b,
455
- onNodeMouseEnter: x,
456
- onNodeMouseLeave: S,
457
- onInit: w,
458
- nodesDraggable: !1,
459
- nodesSelectable: !0,
460
- pannable: !0,
461
- zoomable: !0,
462
- background: a,
463
- ...n
464
- }), t[28] = a, t[29] = l, t[30] = c, t[31] = n, t[32] = g, t[33] = _, t[34] = v, t[35] = y, t[36] = b, t[37] = x, t[38] = S, t[39] = w, t[40] = f, t[41] = p, t[42] = m, t[43] = h, t[44] = T) : T = t[44], T;
724
+ $[28] = background;
725
+ $[29] = edges;
726
+ $[30] = nodes;
727
+ $[31] = props;
728
+ $[32] = t11;
729
+ $[33] = t13;
730
+ $[34] = t15;
731
+ $[35] = t17;
732
+ $[36] = t19;
733
+ $[37] = t21;
734
+ $[38] = t23;
735
+ $[39] = t25;
736
+ $[40] = t3;
737
+ $[41] = t5;
738
+ $[42] = t7;
739
+ $[43] = t9;
740
+ $[44] = t26;
741
+ } else t26 = $[44];
742
+ return t26;
465
743
  });
466
- $.displayName = "ProjectsOverviewXY";
744
+ ProjectsOverviewXY.displayName = "ProjectsOverviewXY";
467
745
  //#endregion
468
746
  //#region ../diagram/src/projects-overview/ProjectsOverview.tsx
469
- function ProjectsOverview({ view: t, onNavigateToProject: n, fitViewPadding: r = {
747
+ function ProjectsOverview({ view, onNavigateToProject, fitViewPadding = {
470
748
  top: "50px",
471
749
  bottom: "32px",
472
750
  left: "32px",
473
751
  right: "32px"
474
- }, ...i }) {
475
- let a = z(ue, { input: {
476
- view: t,
477
- fitViewPadding: r
752
+ }, ...props }) {
753
+ const actorRef = useActorRef(projectOverviewLogic, { input: {
754
+ view,
755
+ fitViewPadding
478
756
  } });
479
- U(() => {
480
- a.send({
757
+ useEffect(() => {
758
+ actorRef.send({
481
759
  type: "update.view",
482
- view: t
760
+ view
483
761
  });
484
- }, [a, t]);
485
- let o = e(n);
486
- U(() => {
487
- let e = [a.on("navigate.to", ({ projectId: e }) => {
488
- o.current?.(e);
762
+ }, [actorRef, view]);
763
+ const onNavigateToProjectRef = useSyncedRef(onNavigateToProject);
764
+ useEffect(() => {
765
+ const subs = [actorRef.on("navigate.to", ({ projectId }) => {
766
+ onNavigateToProjectRef.current?.(projectId);
489
767
  })];
490
768
  return () => {
491
- e.forEach((e) => e.unsubscribe());
769
+ subs.forEach((sub) => sub.unsubscribe());
492
770
  };
493
- }, [a]);
494
- let s = t.bounds, c = W({
771
+ }, [actorRef]);
772
+ const bounds = view.bounds;
773
+ const initialRef = useRef({
495
774
  initialNodes: [],
496
775
  initialEdges: [],
497
- initialWidth: s.width,
498
- initialHeight: s.height,
499
- fitView: !1
776
+ initialWidth: bounds.width,
777
+ initialHeight: bounds.height,
778
+ fitView: false
500
779
  });
501
- return /* @__PURE__ */ K(de, {
502
- value: a,
503
- children: /* @__PURE__ */ q(re, {
504
- ...c.current,
505
- children: [/* @__PURE__ */ K(j, {
506
- id: a.sessionId,
507
- inherit: !1,
508
- children: /* @__PURE__ */ K($, { ...i })
509
- }), /* @__PURE__ */ K(ProjectsOverviewPanel, {})]
780
+ return /* @__PURE__ */ jsx(ProjectsOverviewActorContextProvider, {
781
+ value: actorRef,
782
+ children: /* @__PURE__ */ jsxs(ReactFlowProvider, {
783
+ ...initialRef.current,
784
+ children: [/* @__PURE__ */ jsx(LayoutGroup, {
785
+ id: actorRef.sessionId,
786
+ inherit: false,
787
+ children: /* @__PURE__ */ jsx(ProjectsOverviewXY, { ...props })
788
+ }), /* @__PURE__ */ jsx(ProjectsOverviewPanel, {})]
510
789
  })
511
790
  });
512
791
  }
513
792
  //#endregion
514
793
  //#region ../diagram/src/LikeC4ProjectsOverview.tsx
515
- function LikeC4ProjectsOverview({ view: e, className: t, onNavigateToProject: i, ...a }) {
516
- let o = m(), c = T();
517
- return i ??= o, /* @__PURE__ */ K(s, { children: /* @__PURE__ */ q(r, { children: [/* @__PURE__ */ K(S, { id: c }), /* @__PURE__ */ K(n, {
518
- id: c,
519
- className: t,
520
- children: /* @__PURE__ */ K(ProjectsOverview, {
521
- view: e,
522
- onNavigateToProject: i,
523
- ...a
794
+ function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props }) {
795
+ const onChangeLikeC4Project = useChangeLikeC4Project();
796
+ const id = useId$1();
797
+ onNavigateToProject ??= onChangeLikeC4Project;
798
+ return /* @__PURE__ */ jsx(EnsureMantine, { children: /* @__PURE__ */ jsxs(FramerMotionConfig, { children: [/* @__PURE__ */ jsx(LikeC4Styles, { rootSelector: `#${id}` }), /* @__PURE__ */ jsx(RootContainer, {
799
+ id,
800
+ className,
801
+ children: /* @__PURE__ */ jsx(ProjectsOverview, {
802
+ view,
803
+ onNavigateToProject,
804
+ ...props
524
805
  })
525
806
  })] }) });
526
807
  }
527
808
  //#endregion
528
809
  //#region src/pages/ProjectsOverview.tsx
529
810
  function ProjectsOverviewPage() {
530
- let e = G(3), t = m(), n = le(), r;
531
- return e[0] !== t || e[1] !== n ? (r = /* @__PURE__ */ K(LikeC4ProjectsOverview, {
532
- view: n,
533
- onNavigateToProject: t
534
- }), e[0] = t, e[1] = n, e[2] = r) : r = e[2], r;
811
+ const $ = c(3);
812
+ const changeProject = useChangeLikeC4Project();
813
+ const projectsOverview = useLikeC4ProjectsOverview();
814
+ let t0;
815
+ if ($[0] !== changeProject || $[1] !== projectsOverview) {
816
+ t0 = /* @__PURE__ */ jsx(LikeC4ProjectsOverview, {
817
+ view: projectsOverview,
818
+ onNavigateToProject: changeProject
819
+ });
820
+ $[0] = changeProject;
821
+ $[1] = projectsOverview;
822
+ $[2] = t0;
823
+ } else t0 = $[2];
824
+ return t0;
535
825
  }
536
826
  //#endregion
537
827
  export { ProjectsOverviewPage };