likec4 1.59.4 → 1.61.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.
- package/README.md +2 -0
- package/__app__/codegen/react.mjs +4 -10
- package/__app__/codegen/webcomponent.mjs +6 -131
- package/__app__/index.html +15 -15
- package/__app__/src/aichat/index.mjs +11 -7
- package/__app__/src/chunks/AIChat.mjs +1355 -739
- package/__app__/src/chunks/ErrorComponent.mjs +444 -0
- package/__app__/src/chunks/Header.mjs +269 -0
- package/__app__/src/chunks/ViewReact.mjs +438 -0
- package/__app__/src/chunks/find.mjs +38 -0
- package/__app__/src/chunks/hooks.mjs +158 -472
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +11841 -1417
- package/__app__/src/chunks/libs/@tanstack.mjs +5110 -2404
- package/__app__/src/chunks/libs/fast-equals.mjs +507 -214
- package/__app__/src/chunks/libs/html-to-image.mjs +613 -0
- package/__app__/src/chunks/libs/nanostores.mjs +170 -0
- package/__app__/src/chunks/libs/react-resizable-panels.mjs +2792 -0
- package/__app__/src/chunks/react.mjs +22 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +16 -29
- package/__app__/src/chunks/router.mjs +106 -0
- package/__app__/src/chunks/scope.mjs +106 -0
- package/__app__/src/chunks/searchParams.mjs +29 -0
- package/__app__/src/chunks/single-index.mjs +465 -0
- package/__app__/src/chunks/styled-system.mjs +1826 -2528
- package/__app__/src/chunks/useAsync.mjs +69 -0
- package/__app__/src/chunks/useSyncedRef.mjs +16 -0
- package/__app__/src/components/ColorSchemeToggle.mjs +124 -0
- package/__app__/src/components/CopyToClipboard.mjs +53 -0
- package/__app__/src/components/ErrorComponent.mjs +1 -0
- package/__app__/src/components/NavigationPanel.mjs +63 -0
- package/__app__/src/components/NotFound.mjs +155 -0
- package/__app__/src/components/ViewOutlet.mjs +9 -0
- package/__app__/src/components/model-diff/CompareModelProvider.mjs +44 -0
- package/__app__/src/components/model-diff/ModelDiffPanel.mjs +179 -0
- package/__app__/src/components/model-diff/compare-model.mjs +76 -0
- package/__app__/src/components/model-diff/state.mjs +45 -0
- package/__app__/src/components/search/OverviewSearch.mjs +92 -0
- package/__app__/src/components/search/OverviewSearchAdapter.mjs +94 -0
- package/__app__/src/components/sidebar/DiagramTree.css.mjs +48 -0
- package/__app__/src/components/sidebar/DiagramsTree.mjs +304 -0
- package/__app__/src/components/sidebar/Drawer.mjs +178 -0
- package/__app__/src/components/sidebar/SidebarBurger.mjs +28 -0
- package/__app__/src/components/sidebar/data.mjs +94 -0
- package/__app__/src/components/sidebar/state.mjs +16 -0
- package/__app__/src/components/view-page/Header.mjs +1 -0
- package/__app__/src/components/view-page/SelectProject.mjs +258 -0
- package/__app__/src/components/view-page/ShareModal.mjs +111 -0
- package/__app__/src/components/view-page/share-modal/AlertLocalhost.mjs +31 -0
- package/__app__/src/components/view-page/share-modal/CopyButtonChild.mjs +36 -0
- package/__app__/src/components/view-page/share-modal/EmbedPanel.mjs +100 -0
- package/__app__/src/components/view-page/share-modal/WebcomponentsPanel.mjs +264 -0
- package/__app__/src/components/view-page/state.mjs +17 -0
- package/__app__/src/context/LikeC4CustomizationContext.mjs +26 -0
- package/__app__/src/context/LikeC4IconRendererContext.mjs +29 -0
- package/__app__/src/context/LikeC4ModelContext.mjs +34 -0
- package/__app__/src/context/LikeC4ProjectsContext.mjs +40 -0
- package/__app__/src/context/ModelDiffsContext.mjs +33 -0
- package/__app__/src/context/safeCtx.mjs +14 -0
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/hooks.mjs +1 -0
- package/__app__/src/main.mjs +6 -29151
- package/__app__/src/pages/EmbedPage.mjs +93 -0
- package/__app__/src/pages/ExportPage.mjs +691 -0
- package/__app__/src/pages/ProjectsOverview.mjs +23 -0
- package/__app__/src/pages/ViewAsD2.mjs +105 -0
- package/__app__/src/pages/ViewAsDot.mjs +65 -0
- package/__app__/src/pages/ViewAsMmd.mjs +109 -0
- package/__app__/src/pages/ViewAsPuml.mjs +105 -0
- package/__app__/src/pages/ViewEditor.mjs +220 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/pages/export-layout.mjs +95 -0
- package/__app__/src/pages/export-page-params.mjs +9 -0
- package/__app__/src/pages/styles.css.mjs +23 -0
- package/__app__/src/routeTree.gen.mjs +105 -0
- package/__app__/src/router.mjs +1 -0
- package/__app__/src/routes/__root.mjs +65 -0
- package/__app__/src/routes/index.css.mjs +29 -0
- package/__app__/src/routes/index.mjs +32 -0
- package/__app__/src/routes/project._projectId/-components.mjs +100 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
- package/__app__/src/routes/project._projectId/index.mjs +14 -0
- package/__app__/src/routes/project._projectId/route.mjs +93 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
- package/__app__/src/routes/projects.mjs +36 -0
- package/__app__/src/routes/single-index.mjs +1 -0
- package/__app__/src/routes/webcomponent._.mjs +94 -0
- package/__app__/src/style.css +18497 -1
- package/config/schema.json +146 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +394 -238
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +25 -17
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +255 -194
- package/dist/chunks/index2.d.mts +8246 -3610
- package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/birpc.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +88 -36
- package/dist/chunks/libs/clone.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/fast-equals.mjs +1 -0
- package/dist/chunks/libs/fontkit.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +6707 -6715
- package/dist/chunks/libs/langium.mjs +16 -24
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +1 -1
- package/dist/chunks/libs/pathe.mjs +1 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/node.mjs +111 -77
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +185 -166
- package/dist/cli/index.mjs +254 -1306
- package/dist/config/index.d.mts +66 -5
- package/dist/config/index.mjs +1 -1
- package/dist/generators/likec4.d.mts +6530 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +2 -4
- package/dist/model/index.d.mts +0 -7
- package/dist/vite-plugin/index.d.mts +83 -58
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +8 -0
- package/dist/vite-plugin/internal/index.d.mts +92 -17
- package/dist/vite-plugin/internal/index.mjs +225 -126
- package/generators/likec4/package.json +4 -0
- package/package.json +134 -122
- package/react/index.d.mts +7496 -26659
- package/react/index.mjs +533 -63936
- package/react/rolldown-runtime-CfRud99p.js +1 -0
- package/skills/likec4-dsl/SKILL.md +474 -0
- package/skills/likec4-dsl/evals/evals-public.json +207 -0
- package/skills/likec4-dsl/evals/grading-spec.json +603 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +168 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -0
- package/skills/likec4-dsl/references/diffs.md +52 -0
- package/skills/likec4-dsl/references/dynamic-views.md +455 -0
- package/skills/likec4-dsl/references/examples.md +370 -0
- package/skills/likec4-dsl/references/identifier-validity.md +90 -0
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +180 -0
- package/skills/likec4-dsl/references/model.md +182 -0
- package/skills/likec4-dsl/references/predicates.md +123 -0
- package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
- package/skills/likec4-dsl/references/specification.md +79 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +101 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +126 -51
- package/__app__/src/chunks/LikeC4Styles.mjs +0 -2306
- package/__app__/src/chunks/ProjectsOverview.mjs +0 -537
- package/__app__/src/chunks/es.mjs +0 -439
- package/__app__/src/chunks/libs/@floating-ui.mjs +0 -2532
- package/__app__/src/chunks/libs/@mantine.mjs +0 -13868
- package/__app__/src/chunks/libs/@xstate/react.mjs +0 -2015
- package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -5367
- package/__app__/src/chunks/libs/bezier-js.mjs +0 -1007
- package/__app__/src/chunks/libs/d3.mjs +0 -2817
- package/__app__/src/chunks/libs/framer.mjs +0 -5926
- package/__app__/src/chunks/libs/zod.mjs +0 -3176
- package/dist/chunks/libs/@chevrotain/types.d.mts +0 -108
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -3840
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { t as token } from "../../chunks/styled-system.mjs";
|
|
3
|
+
import { useModelDiffs } from "../../context/ModelDiffsContext.mjs";
|
|
4
|
+
import { selectCompareMode, selectDiff, useModelDiffState } from "./state.mjs";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Box, Group, Paper, SegmentedControl, Select, Stack, Text } from "@mantine/core";
|
|
8
|
+
import { filterCompareView } from "@likec4/core/compute-view";
|
|
9
|
+
// src/components/model-diff/ModelDiffPanel.tsx
|
|
10
|
+
var NoDiff = "__as-is__";
|
|
11
|
+
var compareModes = [
|
|
12
|
+
{
|
|
13
|
+
value: "as-is",
|
|
14
|
+
label: "As-is"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "changes",
|
|
18
|
+
label: "Changes"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "to-be",
|
|
22
|
+
label: "To-be"
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
var legend = [
|
|
26
|
+
{
|
|
27
|
+
label: "added",
|
|
28
|
+
color: token.var("colors.likec4.diff.added"),
|
|
29
|
+
style: "solid"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "removed",
|
|
33
|
+
color: token.var("colors.likec4.diff.removed"),
|
|
34
|
+
style: "dashed"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "modified",
|
|
38
|
+
color: token.var("colors.likec4.diff.modified"),
|
|
39
|
+
style: "dashed"
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Compare view of the selected diff, to show instead of the view.
|
|
44
|
+
* `null` for the model as is, or if the diff does not change the view.
|
|
45
|
+
*/
|
|
46
|
+
function useCompareView(viewId) {
|
|
47
|
+
const $ = c(3);
|
|
48
|
+
const { views } = useModelDiffs();
|
|
49
|
+
const { diffId, mode } = useModelDiffState();
|
|
50
|
+
const view = diffId && viewId ? views[diffId]?.[viewId] : void 0;
|
|
51
|
+
let t0;
|
|
52
|
+
if ($[0] !== mode || $[1] !== view) {
|
|
53
|
+
t0 = view ? filterCompareView(view, mode) : null;
|
|
54
|
+
$[0] = mode;
|
|
55
|
+
$[1] = view;
|
|
56
|
+
$[2] = t0;
|
|
57
|
+
} else t0 = $[2];
|
|
58
|
+
return t0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Model state selector (as-is or a diff) and compare mode.
|
|
62
|
+
* Renders nothing if the project has no diffs.
|
|
63
|
+
*/
|
|
64
|
+
function ModelDiffPanel(t0) {
|
|
65
|
+
const $ = c(15);
|
|
66
|
+
const { viewId } = t0;
|
|
67
|
+
const { diffs, views } = useModelDiffs();
|
|
68
|
+
const { diffId, mode } = useModelDiffState();
|
|
69
|
+
if (diffs.length === 0) return null;
|
|
70
|
+
let t1;
|
|
71
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
|
+
t1 = { zIndex: 20 };
|
|
73
|
+
$[0] = t1;
|
|
74
|
+
} else t1 = $[0];
|
|
75
|
+
let t2;
|
|
76
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
77
|
+
t2 = {
|
|
78
|
+
value: NoDiff,
|
|
79
|
+
label: "As-is (no diff)"
|
|
80
|
+
};
|
|
81
|
+
$[1] = t2;
|
|
82
|
+
} else t2 = $[1];
|
|
83
|
+
let t3;
|
|
84
|
+
if ($[2] !== diffs) {
|
|
85
|
+
t3 = [t2, ...diffs.map(_temp)];
|
|
86
|
+
$[2] = diffs;
|
|
87
|
+
$[3] = t3;
|
|
88
|
+
} else t3 = $[3];
|
|
89
|
+
const t4 = diffId ?? NoDiff;
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[4] !== t3 || $[5] !== t4) {
|
|
92
|
+
t5 = /* @__PURE__ */ jsx(Select, {
|
|
93
|
+
size: "xs",
|
|
94
|
+
"aria-label": "Model state",
|
|
95
|
+
data: t3,
|
|
96
|
+
value: t4,
|
|
97
|
+
allowDeselect: false,
|
|
98
|
+
onChange: _temp2
|
|
99
|
+
});
|
|
100
|
+
$[4] = t3;
|
|
101
|
+
$[5] = t4;
|
|
102
|
+
$[6] = t5;
|
|
103
|
+
} else t5 = $[6];
|
|
104
|
+
let t6;
|
|
105
|
+
if ($[7] !== diffId || $[8] !== mode || $[9] !== viewId || $[10] !== views) {
|
|
106
|
+
t6 = diffId && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
108
|
+
size: "xs",
|
|
109
|
+
fullWidth: true,
|
|
110
|
+
value: mode,
|
|
111
|
+
onChange: selectCompareMode,
|
|
112
|
+
data: compareModes
|
|
113
|
+
}),
|
|
114
|
+
mode === "changes" && /* @__PURE__ */ jsx(Group, {
|
|
115
|
+
gap: "sm",
|
|
116
|
+
children: legend.map(_temp3)
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsx(Text, {
|
|
119
|
+
size: "xs",
|
|
120
|
+
c: "dimmed",
|
|
121
|
+
children: views[diffId]?.[viewId] ? "This view is changed by the diff" : "This view is not changed by the diff"
|
|
122
|
+
})
|
|
123
|
+
] });
|
|
124
|
+
$[7] = diffId;
|
|
125
|
+
$[8] = mode;
|
|
126
|
+
$[9] = viewId;
|
|
127
|
+
$[10] = views;
|
|
128
|
+
$[11] = t6;
|
|
129
|
+
} else t6 = $[11];
|
|
130
|
+
let t7;
|
|
131
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
132
|
+
t7 = /* @__PURE__ */ jsx(Paper, {
|
|
133
|
+
shadow: "md",
|
|
134
|
+
p: "xs",
|
|
135
|
+
withBorder: true,
|
|
136
|
+
pos: "absolute",
|
|
137
|
+
top: 56,
|
|
138
|
+
right: 12,
|
|
139
|
+
w: 280,
|
|
140
|
+
style: t1,
|
|
141
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
142
|
+
gap: "xs",
|
|
143
|
+
children: [t5, t6]
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
$[12] = t5;
|
|
147
|
+
$[13] = t6;
|
|
148
|
+
$[14] = t7;
|
|
149
|
+
} else t7 = $[14];
|
|
150
|
+
return t7;
|
|
151
|
+
}
|
|
152
|
+
function _temp3(item) {
|
|
153
|
+
return /* @__PURE__ */ jsxs(Group, {
|
|
154
|
+
gap: 4,
|
|
155
|
+
wrap: "nowrap",
|
|
156
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
157
|
+
w: 12,
|
|
158
|
+
h: 12,
|
|
159
|
+
style: {
|
|
160
|
+
border: `2px ${item.style} ${item.color}`,
|
|
161
|
+
borderRadius: 3
|
|
162
|
+
}
|
|
163
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
164
|
+
size: "xs",
|
|
165
|
+
c: "dimmed",
|
|
166
|
+
children: item.label
|
|
167
|
+
})]
|
|
168
|
+
}, item.label);
|
|
169
|
+
}
|
|
170
|
+
function _temp2(value) {
|
|
171
|
+
return selectDiff(value && value !== NoDiff ? value : null);
|
|
172
|
+
}
|
|
173
|
+
function _temp(d) {
|
|
174
|
+
return {
|
|
175
|
+
value: d.id,
|
|
176
|
+
label: d.title ?? d.id
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export { ModelDiffPanel, useCompareView };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { applyModelDiff } from "@likec4/core/compute-view";
|
|
3
|
+
import { ElementModel, LikeC4Model, LikeC4ViewModel } from "@likec4/core/model";
|
|
4
|
+
// src/components/model-diff/compare-model.ts
|
|
5
|
+
function idOf(value) {
|
|
6
|
+
return typeof value === "string" ? value : value.id;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Model the detail popups read while a compare view is on screen.
|
|
10
|
+
*
|
|
11
|
+
* Added and modified elements come from the model after the diff.
|
|
12
|
+
* Removed elements come from the model before the diff.
|
|
13
|
+
* `as-is` reads only the model before the diff.
|
|
14
|
+
* The open compare view replaces the view of the same id, so node lookup matches the diagram.
|
|
15
|
+
*/
|
|
16
|
+
function compareLookupModel(before, input) {
|
|
17
|
+
const diff = before.$data.diffs?.[input.diffId];
|
|
18
|
+
if (!diff) return before;
|
|
19
|
+
const after = input.mode === "as-is" ? before : LikeC4Model.create(applyModelDiff(before.$data, diff));
|
|
20
|
+
const useAfter = input.mode !== "as-is";
|
|
21
|
+
let compareViewModel;
|
|
22
|
+
const proxy = new Proxy(before, { get(target, prop, receiver) {
|
|
23
|
+
switch (prop) {
|
|
24
|
+
case "element": return (el) => {
|
|
25
|
+
if (el instanceof ElementModel) return el;
|
|
26
|
+
return (useAfter ? after.findElement(idOf(el)) : null) ?? target.element(el);
|
|
27
|
+
};
|
|
28
|
+
case "findElement": return (el) => {
|
|
29
|
+
return (useAfter ? after.findElement(idOf(el)) : null) ?? target.findElement(el);
|
|
30
|
+
};
|
|
31
|
+
case "relationship": return (rel, type) => {
|
|
32
|
+
if (!useAfter || type === "deployment") return target.relationship(rel, type);
|
|
33
|
+
return after.findRelationship(idOf(rel), type) ?? target.relationship(rel, type);
|
|
34
|
+
};
|
|
35
|
+
case "findRelationship": return (id, type) => {
|
|
36
|
+
if (!useAfter || type === "deployment") return target.findRelationship(id, type);
|
|
37
|
+
return after.findRelationship(id, type) ?? target.findRelationship(id, type);
|
|
38
|
+
};
|
|
39
|
+
case "elements": return function* () {
|
|
40
|
+
const seen = /* @__PURE__ */ new Set();
|
|
41
|
+
if (useAfter) for (const element of after.elements()) {
|
|
42
|
+
seen.add(element.id);
|
|
43
|
+
yield element;
|
|
44
|
+
}
|
|
45
|
+
for (const element of target.elements()) if (!seen.has(element.id)) yield element;
|
|
46
|
+
};
|
|
47
|
+
case "roots": return function* () {
|
|
48
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49
|
+
if (useAfter) for (const element of after.roots()) {
|
|
50
|
+
seen.add(element.id);
|
|
51
|
+
yield element;
|
|
52
|
+
}
|
|
53
|
+
for (const element of target.roots()) if (!seen.has(element.id)) yield element;
|
|
54
|
+
};
|
|
55
|
+
case "findView": return (viewId) => viewModel(viewId) ?? target.findView(viewId);
|
|
56
|
+
case "view": return (viewId) => {
|
|
57
|
+
return viewModel(idOf(viewId)) ?? target.view(viewId);
|
|
58
|
+
};
|
|
59
|
+
default: {
|
|
60
|
+
const value = Reflect.get(target, prop, receiver);
|
|
61
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} });
|
|
65
|
+
function viewModel(viewId) {
|
|
66
|
+
if (viewId !== input.view.id) return null;
|
|
67
|
+
if (!compareViewModel) {
|
|
68
|
+
const existing = before.findView(input.view.id);
|
|
69
|
+
if (!existing) return null;
|
|
70
|
+
compareViewModel = new LikeC4ViewModel(proxy, existing.folder, input.view);
|
|
71
|
+
}
|
|
72
|
+
return compareViewModel;
|
|
73
|
+
}
|
|
74
|
+
return proxy;
|
|
75
|
+
}
|
|
76
|
+
export { compareLookupModel };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { t as useStore } from "../../chunks/react.mjs";
|
|
3
|
+
import { r as atom } from "../../chunks/libs/nanostores.mjs";
|
|
4
|
+
import { useModelDiffs } from "../../context/ModelDiffsContext.mjs";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
// src/components/model-diff/state.ts
|
|
7
|
+
/**
|
|
8
|
+
* Selected diff (`null` shows the model as is) and compare mode, kept across views
|
|
9
|
+
*/
|
|
10
|
+
var $modelDiff = /* @__PURE__ */ atom({
|
|
11
|
+
diffId: null,
|
|
12
|
+
mode: "changes"
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Selected diff (`null` if the project no longer has it) and compare mode
|
|
16
|
+
*/
|
|
17
|
+
function useModelDiffState() {
|
|
18
|
+
const $ = c(3);
|
|
19
|
+
const { diffs } = useModelDiffs();
|
|
20
|
+
const state = useStore($modelDiff);
|
|
21
|
+
let t0;
|
|
22
|
+
if ($[0] !== diffs || $[1] !== state) {
|
|
23
|
+
t0 = diffs.some((d) => d.id === state.diffId) ? state : {
|
|
24
|
+
...state,
|
|
25
|
+
diffId: null
|
|
26
|
+
};
|
|
27
|
+
$[0] = diffs;
|
|
28
|
+
$[1] = state;
|
|
29
|
+
$[2] = t0;
|
|
30
|
+
} else t0 = $[2];
|
|
31
|
+
return t0;
|
|
32
|
+
}
|
|
33
|
+
function selectDiff(diffId) {
|
|
34
|
+
$modelDiff.set({
|
|
35
|
+
...$modelDiff.get(),
|
|
36
|
+
diffId
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function selectCompareMode(mode) {
|
|
40
|
+
$modelDiff.set({
|
|
41
|
+
...$modelDiff.get(),
|
|
42
|
+
mode
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { selectCompareMode, selectDiff, useModelDiffState };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { OverviewSearchAdapter } from "./OverviewSearchAdapter.mjs";
|
|
3
|
+
import { memo, useRef, useState } from "react";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { FramerMotionConfig, Overlay, SearchControl, SearchPanelContent, searchBodyCss, searchDialogCss } from "likec4/react";
|
|
7
|
+
import { useHotkeys } from "@mantine/hooks";
|
|
8
|
+
import { AnimatePresence } from "motion/react";
|
|
9
|
+
// src/components/search/OverviewSearch.tsx
|
|
10
|
+
var OverviewSearch = memo(() => {
|
|
11
|
+
const $ = c(10);
|
|
12
|
+
const [isOpened, setIsOpened] = useState(false);
|
|
13
|
+
const dialogElRef = useRef(null);
|
|
14
|
+
let t0;
|
|
15
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
16
|
+
t0 = () => setIsOpened(true);
|
|
17
|
+
$[0] = t0;
|
|
18
|
+
} else t0 = $[0];
|
|
19
|
+
const open = t0;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
22
|
+
t1 = () => setIsOpened(false);
|
|
23
|
+
$[1] = t1;
|
|
24
|
+
} else t1 = $[1];
|
|
25
|
+
const close = t1;
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
28
|
+
t2 = (node) => {
|
|
29
|
+
if (node) dialogElRef.current = node;
|
|
30
|
+
};
|
|
31
|
+
$[2] = t2;
|
|
32
|
+
} else t2 = $[2];
|
|
33
|
+
const captureDialogRef = t2;
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
36
|
+
t3 = () => {
|
|
37
|
+
if (dialogElRef.current?.open) dialogElRef.current.close();
|
|
38
|
+
dialogElRef.current = null;
|
|
39
|
+
};
|
|
40
|
+
$[3] = t3;
|
|
41
|
+
} else t3 = $[3];
|
|
42
|
+
const handleExitComplete = t3;
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t4 = [[
|
|
46
|
+
"mod+k",
|
|
47
|
+
open,
|
|
48
|
+
{ preventDefault: true }
|
|
49
|
+
]];
|
|
50
|
+
$[4] = t4;
|
|
51
|
+
} else t4 = $[4];
|
|
52
|
+
useHotkeys(t4);
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
55
|
+
t5 = /* @__PURE__ */ jsx(SearchControl, { onClick: open });
|
|
56
|
+
$[5] = t5;
|
|
57
|
+
} else t5 = $[5];
|
|
58
|
+
let t6;
|
|
59
|
+
if ($[6] !== isOpened) {
|
|
60
|
+
t6 = isOpened && /* @__PURE__ */ jsx(Overlay, {
|
|
61
|
+
ref: captureDialogRef,
|
|
62
|
+
fullscreen: true,
|
|
63
|
+
withBackdrop: false,
|
|
64
|
+
backdrop: { opacity: .9 },
|
|
65
|
+
classes: {
|
|
66
|
+
dialog: searchDialogCss,
|
|
67
|
+
body: searchBodyCss
|
|
68
|
+
},
|
|
69
|
+
openDelay: 0,
|
|
70
|
+
onClose: close,
|
|
71
|
+
"data-likec4-search": "true",
|
|
72
|
+
children: /* @__PURE__ */ jsx(OverviewSearchAdapter, {
|
|
73
|
+
onClose: close,
|
|
74
|
+
children: /* @__PURE__ */ jsx(SearchPanelContent, {})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
$[6] = isOpened;
|
|
78
|
+
$[7] = t6;
|
|
79
|
+
} else t6 = $[7];
|
|
80
|
+
let t7;
|
|
81
|
+
if ($[8] !== t6) {
|
|
82
|
+
t7 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, /* @__PURE__ */ jsx(FramerMotionConfig, { children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
83
|
+
onExitComplete: handleExitComplete,
|
|
84
|
+
children: t6
|
|
85
|
+
}) })] });
|
|
86
|
+
$[8] = t6;
|
|
87
|
+
$[9] = t7;
|
|
88
|
+
} else t7 = $[9];
|
|
89
|
+
return t7;
|
|
90
|
+
});
|
|
91
|
+
OverviewSearch.displayName = "OverviewSearch";
|
|
92
|
+
export { OverviewSearch };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { c as useNavigate } from "../../chunks/libs/@tanstack.mjs";
|
|
3
|
+
import { t as useCurrentProject } from "../../chunks/hooks.mjs";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { SearchContext, normalizeSearch } from "likec4/react";
|
|
8
|
+
// src/components/search/OverviewSearchAdapter.tsx
|
|
9
|
+
function OverviewSearchAdapter(t0) {
|
|
10
|
+
const $ = c(17);
|
|
11
|
+
const { onClose, children } = t0;
|
|
12
|
+
const [searchValue, setSearchValue] = useState("");
|
|
13
|
+
const [pickViewFor, setPickViewFor] = useState(null);
|
|
14
|
+
const navigate = useNavigate();
|
|
15
|
+
const { id: projectId } = useCurrentProject();
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] !== navigate || $[1] !== onClose || $[2] !== projectId) {
|
|
18
|
+
t1 = (viewId, focusOnElement) => {
|
|
19
|
+
onClose();
|
|
20
|
+
navigate({
|
|
21
|
+
to: "/project/$projectId/view/$viewId/",
|
|
22
|
+
params: {
|
|
23
|
+
projectId,
|
|
24
|
+
viewId
|
|
25
|
+
},
|
|
26
|
+
search: (prev) => ({
|
|
27
|
+
...prev,
|
|
28
|
+
...focusOnElement && { focusOnElement }
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
$[0] = navigate;
|
|
33
|
+
$[1] = onClose;
|
|
34
|
+
$[2] = projectId;
|
|
35
|
+
$[3] = t1;
|
|
36
|
+
} else t1 = $[3];
|
|
37
|
+
const navigateTo = t1;
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
+
t2 = (elementFqn) => {
|
|
41
|
+
setPickViewFor(elementFqn);
|
|
42
|
+
};
|
|
43
|
+
$[4] = t2;
|
|
44
|
+
} else t2 = $[4];
|
|
45
|
+
const openPickView = t2;
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
48
|
+
t3 = () => {
|
|
49
|
+
setPickViewFor(null);
|
|
50
|
+
};
|
|
51
|
+
$[5] = t3;
|
|
52
|
+
} else t3 = $[5];
|
|
53
|
+
const closePickView = t3;
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[6] !== searchValue) {
|
|
56
|
+
t4 = normalizeSearch(searchValue);
|
|
57
|
+
$[6] = searchValue;
|
|
58
|
+
$[7] = t4;
|
|
59
|
+
} else t4 = $[7];
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[8] !== navigateTo || $[9] !== onClose || $[10] !== pickViewFor || $[11] !== searchValue || $[12] !== t4) {
|
|
62
|
+
t5 = {
|
|
63
|
+
searchValue,
|
|
64
|
+
setSearchValue,
|
|
65
|
+
normalizedSearch: t4,
|
|
66
|
+
navigateTo,
|
|
67
|
+
openPickView,
|
|
68
|
+
closePickView,
|
|
69
|
+
pickViewFor,
|
|
70
|
+
close: onClose,
|
|
71
|
+
currentViewId: null,
|
|
72
|
+
openedWithSearch: null
|
|
73
|
+
};
|
|
74
|
+
$[8] = navigateTo;
|
|
75
|
+
$[9] = onClose;
|
|
76
|
+
$[10] = pickViewFor;
|
|
77
|
+
$[11] = searchValue;
|
|
78
|
+
$[12] = t4;
|
|
79
|
+
$[13] = t5;
|
|
80
|
+
} else t5 = $[13];
|
|
81
|
+
const value = t5;
|
|
82
|
+
let t6;
|
|
83
|
+
if ($[14] !== children || $[15] !== value) {
|
|
84
|
+
t6 = /* @__PURE__ */ jsx(SearchContext.Provider, {
|
|
85
|
+
value,
|
|
86
|
+
children
|
|
87
|
+
});
|
|
88
|
+
$[14] = children;
|
|
89
|
+
$[15] = value;
|
|
90
|
+
$[16] = t6;
|
|
91
|
+
} else t6 = $[16];
|
|
92
|
+
return t6;
|
|
93
|
+
}
|
|
94
|
+
export { OverviewSearchAdapter };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { f as css } from "../../chunks/styled-system.mjs";
|
|
2
|
+
// src/components/sidebar/DiagramTree.css.ts
|
|
3
|
+
var navsidebar = css({
|
|
4
|
+
backdropFilter: "[blur(6px)]",
|
|
5
|
+
transitionProperty: "common",
|
|
6
|
+
transition: "slow",
|
|
7
|
+
transform: "translateX(-100%)",
|
|
8
|
+
_before: {
|
|
9
|
+
transitionProperty: "common",
|
|
10
|
+
transition: "slow",
|
|
11
|
+
position: "absolute",
|
|
12
|
+
content: "\" \"",
|
|
13
|
+
inset: "0",
|
|
14
|
+
background: "mantine.gray[7]",
|
|
15
|
+
opacity: "0.7",
|
|
16
|
+
zIndex: "[1]"
|
|
17
|
+
},
|
|
18
|
+
"& > div": {
|
|
19
|
+
position: "relative",
|
|
20
|
+
zIndex: "[2]"
|
|
21
|
+
},
|
|
22
|
+
"&[data-opened='true']": { transform: "translateX(0)" }
|
|
23
|
+
});
|
|
24
|
+
var trigger = css({
|
|
25
|
+
cursor: "pointer",
|
|
26
|
+
_before: {
|
|
27
|
+
transitionProperty: "common",
|
|
28
|
+
transitionTimingFunction: "[cubic-bezier(0,0.31,0,1.03)]",
|
|
29
|
+
transitionDuration: "fast",
|
|
30
|
+
position: "absolute",
|
|
31
|
+
content: "",
|
|
32
|
+
inset: "0",
|
|
33
|
+
background: "mantine.gray[7]",
|
|
34
|
+
opacity: "0",
|
|
35
|
+
zIndex: "[1]"
|
|
36
|
+
},
|
|
37
|
+
"& > *": {
|
|
38
|
+
position: "relative",
|
|
39
|
+
zIndex: "[2]"
|
|
40
|
+
},
|
|
41
|
+
"&:hover::before": {
|
|
42
|
+
visibility: "visible",
|
|
43
|
+
opacity: "0.7"
|
|
44
|
+
},
|
|
45
|
+
"&[data-opened='true']": { visibility: "hidden" }
|
|
46
|
+
});
|
|
47
|
+
var diagramPreview = css({ pointerEvents: "none" });
|
|
48
|
+
export { diagramPreview, navsidebar, trigger };
|