likec4 1.60.0 → 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 +5 -208
- package/__app__/index.html +15 -15
- package/__app__/src/aichat/index.mjs +1 -2
- package/__app__/src/chunks/AIChat.mjs +292 -117
- 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 +18 -541
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +11101 -1797
- package/__app__/src/chunks/libs/@tanstack.mjs +4563 -3083
- package/__app__/src/chunks/libs/fast-equals.mjs +140 -71
- package/__app__/src/chunks/{es.mjs → libs/html-to-image.mjs} +16 -22
- package/__app__/src/chunks/libs/nanostores.mjs +4 -8
- 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 +3 -32
- 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 +1916 -2946
- 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/hooks.mjs +1 -0
- package/__app__/src/main.mjs +4 -48126
- 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 +1156 -1147
- package/config/schema.json +26 -2
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +375 -393
- package/dist/chunks/filenames.mjs +26 -20
- package/dist/chunks/generate-likec4.mjs +4 -4
- package/dist/chunks/index.d.mts +16 -15
- package/dist/chunks/index2.d.mts +7041 -3293
- package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -5
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
- package/dist/chunks/libs/chevrotain.mjs +19 -19
- 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/langium.d.mts +80 -2933
- package/dist/chunks/libs/langium.mjs +6 -6
- package/dist/chunks/libs/pako.mjs +1 -1
- package/dist/chunks/libs/pathe.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/node.mjs +110 -77
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +183 -164
- package/dist/cli/index.mjs +157 -101
- package/dist/config/index.d.mts +65 -4
- package/dist/config/index.mjs +1 -1
- package/dist/generators/likec4.d.mts +16 -64
- package/dist/index.d.mts +2 -4
- package/dist/model/index.d.mts +0 -10
- package/dist/vite-plugin/index.d.mts +83 -61
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -2
- package/dist/vite-plugin/internal/index.d.mts +91 -17
- package/dist/vite-plugin/internal/index.mjs +156 -110
- package/package.json +60 -55
- package/react/index.d.mts +3010 -4014
- package/react/index.mjs +170 -171
- package/react/rolldown-runtime-CfRud99p.js +1 -0
- package/skills/likec4-dsl/SKILL.md +71 -25
- package/skills/likec4-dsl/evals/evals-public.json +5 -0
- package/skills/likec4-dsl/evals/grading-spec.json +15 -1
- package/skills/likec4-dsl/references/cli.md +39 -10
- package/skills/likec4-dsl/references/configuration.md +5 -5
- package/skills/likec4-dsl/references/diffs.md +52 -0
- package/skills/likec4-dsl/references/examples.md +2 -2
- package/skills/likec4-dsl/references/identifier-validity.md +31 -31
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +16 -15
- package/skills/likec4-dsl/references/model.md +42 -11
- package/skills/likec4-dsl/references/specification.md +11 -7
- package/skills/likec4-dsl/references/troubleshooting.md +47 -42
- package/skills/likec4-dsl/references/views.md +2 -2
- package/vite-plugin-modules.d.ts +126 -51
- package/__app__/src/chunks/LikeC4Styles.mjs +0 -4522
- package/__app__/src/chunks/ProjectsOverview.mjs +0 -827
- package/__app__/src/chunks/libs/@floating-ui.mjs +0 -3286
- package/__app__/src/chunks/libs/@mantine.mjs +0 -17731
- package/__app__/src/chunks/libs/@xstate/react.mjs +0 -3471
- package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -7927
- package/__app__/src/chunks/libs/bezier-js.mjs +0 -1593
- package/__app__/src/chunks/libs/d3.mjs +0 -4531
- package/__app__/src/chunks/libs/framer.mjs +0 -11331
- package/__app__/src/chunks/libs/zod.mjs +0 -5404
- package/dist/chunks/libs/@chevrotain/types.d.mts +0 -111
- package/react/rolldown-runtime-DnkiqaRY.js +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { f as css, r as Txt } from "../../chunks/styled-system.mjs";
|
|
3
|
+
import { m as IconChevronDown, s as IconSearch } from "../../chunks/libs/@tabler/icons-react.mjs";
|
|
4
|
+
import { s as Link } from "../../chunks/libs/@tanstack.mjs";
|
|
5
|
+
import { t as useCurrentProject } from "../../chunks/hooks.mjs";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Button, Highlight, Menu, MenuDivider, MenuDropdown, MenuItem, MenuSearch, MenuTarget, ScrollArea } from "@mantine/core";
|
|
10
|
+
import { filterProjects, projectSearchHighlights, useLikeC4Projects } from "likec4/react";
|
|
11
|
+
// src/components/view-page/SelectProject.tsx
|
|
12
|
+
function SelectProject() {
|
|
13
|
+
const $ = c(55);
|
|
14
|
+
const projects = useLikeC4Projects();
|
|
15
|
+
const currentProject = useCurrentProject();
|
|
16
|
+
const [search, setSearch] = useState("");
|
|
17
|
+
if (projects.length < 2) return null;
|
|
18
|
+
let T0;
|
|
19
|
+
let T1;
|
|
20
|
+
let T2;
|
|
21
|
+
let t0;
|
|
22
|
+
let t1;
|
|
23
|
+
let t10;
|
|
24
|
+
let t11;
|
|
25
|
+
let t2;
|
|
26
|
+
let t3;
|
|
27
|
+
let t4;
|
|
28
|
+
let t5;
|
|
29
|
+
let t6;
|
|
30
|
+
let t7;
|
|
31
|
+
let t8;
|
|
32
|
+
let t9;
|
|
33
|
+
if ($[0] !== currentProject.id || $[1] !== currentProject.title || $[2] !== projects || $[3] !== search) {
|
|
34
|
+
const found = filterProjects(projects, search);
|
|
35
|
+
let t12;
|
|
36
|
+
if ($[19] !== search) {
|
|
37
|
+
t12 = projectSearchHighlights(search);
|
|
38
|
+
$[19] = search;
|
|
39
|
+
$[20] = t12;
|
|
40
|
+
} else t12 = $[20];
|
|
41
|
+
const highlight = t12;
|
|
42
|
+
T2 = Menu;
|
|
43
|
+
t7 = "max-content";
|
|
44
|
+
t8 = "click";
|
|
45
|
+
t9 = "bottom-start";
|
|
46
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47
|
+
t10 = { itemSection: css({ maxWidth: "[250px]" }) };
|
|
48
|
+
$[21] = t10;
|
|
49
|
+
} else t10 = $[21];
|
|
50
|
+
let t13;
|
|
51
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
52
|
+
t13 = /* @__PURE__ */ jsx(IconChevronDown, {
|
|
53
|
+
opacity: .5,
|
|
54
|
+
size: 14
|
|
55
|
+
});
|
|
56
|
+
$[22] = t13;
|
|
57
|
+
} else t13 = $[22];
|
|
58
|
+
const t14 = currentProject.title ?? currentProject.id;
|
|
59
|
+
if ($[23] !== t14) {
|
|
60
|
+
t11 = /* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(Button, {
|
|
61
|
+
variant: "subtle",
|
|
62
|
+
size: "compact-md",
|
|
63
|
+
fz: "sm",
|
|
64
|
+
color: "gray",
|
|
65
|
+
px: "sm",
|
|
66
|
+
maw: "250",
|
|
67
|
+
rightSection: t13,
|
|
68
|
+
visibleFrom: "md",
|
|
69
|
+
children: t14
|
|
70
|
+
}) });
|
|
71
|
+
$[23] = t14;
|
|
72
|
+
$[24] = t11;
|
|
73
|
+
} else t11 = $[24];
|
|
74
|
+
T1 = MenuDropdown;
|
|
75
|
+
const t15 = `Search ${projects.length} projects (* wildcard)`;
|
|
76
|
+
let t16;
|
|
77
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
78
|
+
t16 = /* @__PURE__ */ jsx(IconSearch, { size: 14 });
|
|
79
|
+
$[25] = t16;
|
|
80
|
+
} else t16 = $[25];
|
|
81
|
+
let t17;
|
|
82
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
83
|
+
t17 = (e) => setSearch(e.currentTarget.value);
|
|
84
|
+
$[26] = t17;
|
|
85
|
+
} else t17 = $[26];
|
|
86
|
+
if ($[27] !== search || $[28] !== t15) {
|
|
87
|
+
t4 = /* @__PURE__ */ jsx(MenuSearch, {
|
|
88
|
+
miw: 300,
|
|
89
|
+
mb: 4,
|
|
90
|
+
placeholder: t15,
|
|
91
|
+
leftSection: t16,
|
|
92
|
+
value: search,
|
|
93
|
+
onChange: t17
|
|
94
|
+
});
|
|
95
|
+
$[27] = search;
|
|
96
|
+
$[28] = t15;
|
|
97
|
+
$[29] = t4;
|
|
98
|
+
} else t4 = $[29];
|
|
99
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
100
|
+
t5 = /* @__PURE__ */ jsx(MenuItem, {
|
|
101
|
+
renderRoot: _temp,
|
|
102
|
+
children: "Overview"
|
|
103
|
+
});
|
|
104
|
+
t6 = /* @__PURE__ */ jsx(MenuDivider, {});
|
|
105
|
+
$[30] = t5;
|
|
106
|
+
$[31] = t6;
|
|
107
|
+
} else {
|
|
108
|
+
t5 = $[30];
|
|
109
|
+
t6 = $[31];
|
|
110
|
+
}
|
|
111
|
+
T0 = ScrollArea.Autosize;
|
|
112
|
+
t0 = "min(65vh, 560px)";
|
|
113
|
+
t1 = "auto";
|
|
114
|
+
t2 = found.length === 0 && /* @__PURE__ */ jsx(Txt, {
|
|
115
|
+
fontSize: "sm",
|
|
116
|
+
color: "text.dimmed",
|
|
117
|
+
px: "3",
|
|
118
|
+
py: "1.5",
|
|
119
|
+
children: "No matching project"
|
|
120
|
+
});
|
|
121
|
+
let t18;
|
|
122
|
+
if ($[32] !== currentProject.id || $[33] !== highlight) {
|
|
123
|
+
t18 = (t19) => {
|
|
124
|
+
const { id, title, path } = t19;
|
|
125
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
126
|
+
renderRoot: (props_0) => /* @__PURE__ */ jsx(Link, {
|
|
127
|
+
...props_0,
|
|
128
|
+
to: "/project/$projectId/view/$viewId/",
|
|
129
|
+
params: {
|
|
130
|
+
projectId: id,
|
|
131
|
+
viewId: "index"
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
rightSection: !!path && /* @__PURE__ */ jsx(Txt, {
|
|
135
|
+
fontSize: "xxs",
|
|
136
|
+
color: "text.non-essential",
|
|
137
|
+
truncate: true,
|
|
138
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
139
|
+
component: "span",
|
|
140
|
+
highlight,
|
|
141
|
+
inherit: true,
|
|
142
|
+
children: path
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
children: /* @__PURE__ */ jsx(Txt, {
|
|
146
|
+
fontSize: "sm",
|
|
147
|
+
truncate: true,
|
|
148
|
+
maxWidth: "[300px]",
|
|
149
|
+
css: currentProject.id === id ? {
|
|
150
|
+
color: "text.bright",
|
|
151
|
+
fontWeight: "semibold"
|
|
152
|
+
} : {},
|
|
153
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
154
|
+
component: "span",
|
|
155
|
+
highlight,
|
|
156
|
+
inherit: true,
|
|
157
|
+
children: title ?? id
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}, id);
|
|
161
|
+
};
|
|
162
|
+
$[32] = currentProject.id;
|
|
163
|
+
$[33] = highlight;
|
|
164
|
+
$[34] = t18;
|
|
165
|
+
} else t18 = $[34];
|
|
166
|
+
t3 = found.map(t18);
|
|
167
|
+
$[0] = currentProject.id;
|
|
168
|
+
$[1] = currentProject.title;
|
|
169
|
+
$[2] = projects;
|
|
170
|
+
$[3] = search;
|
|
171
|
+
$[4] = T0;
|
|
172
|
+
$[5] = T1;
|
|
173
|
+
$[6] = T2;
|
|
174
|
+
$[7] = t0;
|
|
175
|
+
$[8] = t1;
|
|
176
|
+
$[9] = t10;
|
|
177
|
+
$[10] = t11;
|
|
178
|
+
$[11] = t2;
|
|
179
|
+
$[12] = t3;
|
|
180
|
+
$[13] = t4;
|
|
181
|
+
$[14] = t5;
|
|
182
|
+
$[15] = t6;
|
|
183
|
+
$[16] = t7;
|
|
184
|
+
$[17] = t8;
|
|
185
|
+
$[18] = t9;
|
|
186
|
+
} else {
|
|
187
|
+
T0 = $[4];
|
|
188
|
+
T1 = $[5];
|
|
189
|
+
T2 = $[6];
|
|
190
|
+
t0 = $[7];
|
|
191
|
+
t1 = $[8];
|
|
192
|
+
t10 = $[9];
|
|
193
|
+
t11 = $[10];
|
|
194
|
+
t2 = $[11];
|
|
195
|
+
t3 = $[12];
|
|
196
|
+
t4 = $[13];
|
|
197
|
+
t5 = $[14];
|
|
198
|
+
t6 = $[15];
|
|
199
|
+
t7 = $[16];
|
|
200
|
+
t8 = $[17];
|
|
201
|
+
t9 = $[18];
|
|
202
|
+
}
|
|
203
|
+
let t12;
|
|
204
|
+
if ($[35] !== T0 || $[36] !== t0 || $[37] !== t1 || $[38] !== t2 || $[39] !== t3) {
|
|
205
|
+
t12 = /* @__PURE__ */ jsxs(T0, {
|
|
206
|
+
mah: t0,
|
|
207
|
+
type: t1,
|
|
208
|
+
children: [t2, t3]
|
|
209
|
+
});
|
|
210
|
+
$[35] = T0;
|
|
211
|
+
$[36] = t0;
|
|
212
|
+
$[37] = t1;
|
|
213
|
+
$[38] = t2;
|
|
214
|
+
$[39] = t3;
|
|
215
|
+
$[40] = t12;
|
|
216
|
+
} else t12 = $[40];
|
|
217
|
+
let t13;
|
|
218
|
+
if ($[41] !== T1 || $[42] !== t12 || $[43] !== t4 || $[44] !== t5 || $[45] !== t6) {
|
|
219
|
+
t13 = /* @__PURE__ */ jsxs(T1, { children: [
|
|
220
|
+
t4,
|
|
221
|
+
t5,
|
|
222
|
+
t6,
|
|
223
|
+
t12
|
|
224
|
+
] });
|
|
225
|
+
$[41] = T1;
|
|
226
|
+
$[42] = t12;
|
|
227
|
+
$[43] = t4;
|
|
228
|
+
$[44] = t5;
|
|
229
|
+
$[45] = t6;
|
|
230
|
+
$[46] = t13;
|
|
231
|
+
} else t13 = $[46];
|
|
232
|
+
let t14;
|
|
233
|
+
if ($[47] !== T2 || $[48] !== t10 || $[49] !== t11 || $[50] !== t13 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
|
|
234
|
+
t14 = /* @__PURE__ */ jsxs(T2, {
|
|
235
|
+
width: t7,
|
|
236
|
+
trigger: t8,
|
|
237
|
+
position: t9,
|
|
238
|
+
classNames: t10,
|
|
239
|
+
children: [t11, t13]
|
|
240
|
+
});
|
|
241
|
+
$[47] = T2;
|
|
242
|
+
$[48] = t10;
|
|
243
|
+
$[49] = t11;
|
|
244
|
+
$[50] = t13;
|
|
245
|
+
$[51] = t7;
|
|
246
|
+
$[52] = t8;
|
|
247
|
+
$[53] = t9;
|
|
248
|
+
$[54] = t14;
|
|
249
|
+
} else t14 = $[54];
|
|
250
|
+
return t14;
|
|
251
|
+
}
|
|
252
|
+
function _temp(props) {
|
|
253
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
254
|
+
...props,
|
|
255
|
+
to: "/projects"
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export { SelectProject };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { n as useCurrentView } from "../../chunks/hooks.mjs";
|
|
3
|
+
import { EmbedPanel } from "./share-modal/EmbedPanel.mjs";
|
|
4
|
+
import { WebcomponentsPanel } from "./share-modal/WebcomponentsPanel.mjs";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Button, Group, ModalBody, ModalContent, ModalOverlay, ModalRoot, Tabs, TabsList, TabsPanel, TabsTab } from "@mantine/core";
|
|
9
|
+
// src/components/view-page/ShareModal.tsx
|
|
10
|
+
function ShareModal(t0) {
|
|
11
|
+
const $ = c(19);
|
|
12
|
+
const { onClose } = t0;
|
|
13
|
+
const [diagram] = useCurrentView();
|
|
14
|
+
const [activeTab, setActiveTab] = useState("webcomponent");
|
|
15
|
+
if (!diagram) return null;
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
|
+
t1 = /* @__PURE__ */ jsx(ModalOverlay, {
|
|
19
|
+
backgroundOpacity: .5,
|
|
20
|
+
blur: 3
|
|
21
|
+
});
|
|
22
|
+
$[0] = t1;
|
|
23
|
+
} else t1 = $[0];
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
26
|
+
t2 = (tab) => setActiveTab(tab ?? "webcomponent");
|
|
27
|
+
$[1] = t2;
|
|
28
|
+
} else t2 = $[1];
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t3 = /* @__PURE__ */ jsxs(TabsList, { children: [/* @__PURE__ */ jsx(TabsTab, {
|
|
32
|
+
value: "webcomponent",
|
|
33
|
+
children: "Webcomponent"
|
|
34
|
+
}), /* @__PURE__ */ jsx(TabsTab, {
|
|
35
|
+
value: "embed",
|
|
36
|
+
children: "Embedded"
|
|
37
|
+
})] });
|
|
38
|
+
$[2] = t3;
|
|
39
|
+
} else t3 = $[2];
|
|
40
|
+
let t4;
|
|
41
|
+
if ($[3] !== diagram) {
|
|
42
|
+
t4 = /* @__PURE__ */ jsx(TabsPanel, {
|
|
43
|
+
value: "embed",
|
|
44
|
+
pt: "md",
|
|
45
|
+
children: /* @__PURE__ */ jsx(EmbedPanel, { diagram })
|
|
46
|
+
});
|
|
47
|
+
$[3] = diagram;
|
|
48
|
+
$[4] = t4;
|
|
49
|
+
} else t4 = $[4];
|
|
50
|
+
let t5;
|
|
51
|
+
if ($[5] !== diagram) {
|
|
52
|
+
t5 = /* @__PURE__ */ jsx(TabsPanel, {
|
|
53
|
+
value: "webcomponent",
|
|
54
|
+
pt: "md",
|
|
55
|
+
children: /* @__PURE__ */ jsx(WebcomponentsPanel, { diagram })
|
|
56
|
+
});
|
|
57
|
+
$[5] = diagram;
|
|
58
|
+
$[6] = t5;
|
|
59
|
+
} else t5 = $[6];
|
|
60
|
+
let t6;
|
|
61
|
+
if ($[7] !== activeTab || $[8] !== t4 || $[9] !== t5) {
|
|
62
|
+
t6 = /* @__PURE__ */ jsxs(Tabs, {
|
|
63
|
+
value: activeTab,
|
|
64
|
+
onChange: t2,
|
|
65
|
+
children: [
|
|
66
|
+
t3,
|
|
67
|
+
t4,
|
|
68
|
+
t5
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
$[7] = activeTab;
|
|
72
|
+
$[8] = t4;
|
|
73
|
+
$[9] = t5;
|
|
74
|
+
$[10] = t6;
|
|
75
|
+
} else t6 = $[10];
|
|
76
|
+
let t7;
|
|
77
|
+
if ($[11] !== onClose) {
|
|
78
|
+
t7 = /* @__PURE__ */ jsx(Group, {
|
|
79
|
+
justify: "flex-end",
|
|
80
|
+
mt: "lg",
|
|
81
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
82
|
+
size: "sm",
|
|
83
|
+
onClick: onClose,
|
|
84
|
+
children: "Close"
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
$[11] = onClose;
|
|
88
|
+
$[12] = t7;
|
|
89
|
+
} else t7 = $[12];
|
|
90
|
+
let t8;
|
|
91
|
+
if ($[13] !== t6 || $[14] !== t7) {
|
|
92
|
+
t8 = /* @__PURE__ */ jsx(ModalContent, { children: /* @__PURE__ */ jsxs(ModalBody, { children: [t6, t7] }) });
|
|
93
|
+
$[13] = t6;
|
|
94
|
+
$[14] = t7;
|
|
95
|
+
$[15] = t8;
|
|
96
|
+
} else t8 = $[15];
|
|
97
|
+
let t9;
|
|
98
|
+
if ($[16] !== onClose || $[17] !== t8) {
|
|
99
|
+
t9 = /* @__PURE__ */ jsxs(ModalRoot, {
|
|
100
|
+
size: "xl",
|
|
101
|
+
opened: true,
|
|
102
|
+
onClose,
|
|
103
|
+
children: [t1, t8]
|
|
104
|
+
});
|
|
105
|
+
$[16] = onClose;
|
|
106
|
+
$[17] = t8;
|
|
107
|
+
$[18] = t9;
|
|
108
|
+
} else t9 = $[18];
|
|
109
|
+
return t9;
|
|
110
|
+
}
|
|
111
|
+
export { ShareModal };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { _ as IconAlertTriangle } from "../../../chunks/libs/@tabler/icons-react.mjs";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Alert, Text, rem } from "@mantine/core";
|
|
6
|
+
// src/components/view-page/share-modal/AlertLocalhost.tsx
|
|
7
|
+
var AlertLocalhost = () => {
|
|
8
|
+
const $ = c(2);
|
|
9
|
+
let t0;
|
|
10
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11
|
+
t0 = /* @__PURE__ */ jsx(IconAlertTriangle, {});
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
} else t0 = $[0];
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
16
|
+
t1 = /* @__PURE__ */ jsx(Alert, {
|
|
17
|
+
color: "yellow",
|
|
18
|
+
icon: t0,
|
|
19
|
+
title: "Localhost URL",
|
|
20
|
+
styles: { body: { gap: rem(4) } },
|
|
21
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
22
|
+
c: "yellow",
|
|
23
|
+
size: "sm",
|
|
24
|
+
children: "You need to deploy your project to make it available on the internet"
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
$[1] = t1;
|
|
28
|
+
} else t1 = $[1];
|
|
29
|
+
return t1;
|
|
30
|
+
};
|
|
31
|
+
export { AlertLocalhost };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "../../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { h as IconCheck, p as IconCopy } from "../../../chunks/libs/@tabler/icons-react.mjs";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Button, rem } from "@mantine/core";
|
|
6
|
+
// src/components/view-page/share-modal/CopyButtonChild.tsx
|
|
7
|
+
var CopyButtonChild = (t0) => {
|
|
8
|
+
const $ = c(7);
|
|
9
|
+
const { copied, copy } = t0;
|
|
10
|
+
const t1 = copied ? "teal" : "gray";
|
|
11
|
+
let t2;
|
|
12
|
+
if ($[0] !== copied) {
|
|
13
|
+
t2 = copied ? /* @__PURE__ */ jsx(IconCheck, { style: { width: rem(16) } }) : /* @__PURE__ */ jsx(IconCopy, { style: { width: rem(16) } });
|
|
14
|
+
$[0] = copied;
|
|
15
|
+
$[1] = t2;
|
|
16
|
+
} else t2 = $[1];
|
|
17
|
+
const t3 = copied ? "Copied" : "Copy to clipboard";
|
|
18
|
+
let t4;
|
|
19
|
+
if ($[2] !== copy || $[3] !== t1 || $[4] !== t2 || $[5] !== t3) {
|
|
20
|
+
t4 = /* @__PURE__ */ jsx(Button, {
|
|
21
|
+
size: "xs",
|
|
22
|
+
color: t1,
|
|
23
|
+
variant: "light",
|
|
24
|
+
leftSection: t2,
|
|
25
|
+
onClick: copy,
|
|
26
|
+
children: t3
|
|
27
|
+
});
|
|
28
|
+
$[2] = copy;
|
|
29
|
+
$[3] = t1;
|
|
30
|
+
$[4] = t2;
|
|
31
|
+
$[5] = t3;
|
|
32
|
+
$[6] = t4;
|
|
33
|
+
} else t4 = $[6];
|
|
34
|
+
return t4;
|
|
35
|
+
};
|
|
36
|
+
export { CopyButtonChild };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import "../../../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { f as IconExternalLink } from "../../../chunks/libs/@tabler/icons-react.mjs";
|
|
3
|
+
import { d as useRouter } from "../../../chunks/libs/@tanstack.mjs";
|
|
4
|
+
import { t as useCurrentProject } from "../../../chunks/hooks.mjs";
|
|
5
|
+
import { AlertLocalhost } from "./AlertLocalhost.mjs";
|
|
6
|
+
import { CopyButtonChild } from "./CopyButtonChild.mjs";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useHashHistory } from "likec4:app-config";
|
|
10
|
+
import { ActionIcon, Box, Code, CopyButton, Group, Select, Stack, Text, useMantineColorScheme } from "@mantine/core";
|
|
11
|
+
// src/components/view-page/share-modal/EmbedPanel.tsx
|
|
12
|
+
var EmbedPanel = ({ diagram }) => {
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
const { id: projectId } = useCurrentProject();
|
|
15
|
+
const { colorScheme } = useMantineColorScheme();
|
|
16
|
+
const [theme, setTheme] = useState(colorScheme);
|
|
17
|
+
let location = router.buildLocation({
|
|
18
|
+
to: "/project/$projectId/embed/$viewId/",
|
|
19
|
+
params: {
|
|
20
|
+
projectId,
|
|
21
|
+
viewId: diagram.id
|
|
22
|
+
},
|
|
23
|
+
search: {
|
|
24
|
+
padding: 20,
|
|
25
|
+
...theme !== "auto" ? { theme } : {}
|
|
26
|
+
}
|
|
27
|
+
}).publicHref;
|
|
28
|
+
location = useHashHistory ? `#${location}` : location;
|
|
29
|
+
const url = new URL(location, window.location.href);
|
|
30
|
+
const width = diagram.bounds.width + 40;
|
|
31
|
+
const height = diagram.bounds.height + 40;
|
|
32
|
+
const href = url.href;
|
|
33
|
+
const code = `
|
|
34
|
+
<div style="aspect-ratio:${width}/${height};width:100%;height:auto;max-width:${width}px;margin:0 auto">
|
|
35
|
+
<iframe src="${href}" width="100%" height="100%" style="border:0;background:transparent;"></iframe>
|
|
36
|
+
</div>
|
|
37
|
+
`.trim();
|
|
38
|
+
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
39
|
+
code.includes("http://localhost") && /* @__PURE__ */ jsx(AlertLocalhost, {}),
|
|
40
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
|
|
41
|
+
size: "sm",
|
|
42
|
+
children: "Embedded view is an iframe with a static diagram"
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
45
|
+
gap: "xs",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(Group, {
|
|
48
|
+
justify: "space-between",
|
|
49
|
+
children: [/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
|
|
50
|
+
fw: "500",
|
|
51
|
+
size: "sm",
|
|
52
|
+
children: "HTML"
|
|
53
|
+
}) }), /* @__PURE__ */ jsxs(Group, {
|
|
54
|
+
gap: "xs",
|
|
55
|
+
children: [/* @__PURE__ */ jsx(ActionIcon, {
|
|
56
|
+
component: "a",
|
|
57
|
+
href,
|
|
58
|
+
target: "_blank",
|
|
59
|
+
variant: "light",
|
|
60
|
+
color: "gray",
|
|
61
|
+
children: /* @__PURE__ */ jsx(IconExternalLink, {})
|
|
62
|
+
}), /* @__PURE__ */ jsx(CopyButton, {
|
|
63
|
+
value: code,
|
|
64
|
+
timeout: 1500,
|
|
65
|
+
children: CopyButtonChild
|
|
66
|
+
})]
|
|
67
|
+
})]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx(Code, {
|
|
70
|
+
block: true,
|
|
71
|
+
children: code
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsx(Box, {
|
|
74
|
+
style: { "alignSelf": "flex-start" },
|
|
75
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
76
|
+
label: "Color scheme",
|
|
77
|
+
value: theme,
|
|
78
|
+
allowDeselect: false,
|
|
79
|
+
onChange: (v) => setTheme(v ?? "auto"),
|
|
80
|
+
data: [
|
|
81
|
+
{
|
|
82
|
+
value: "auto",
|
|
83
|
+
label: "Auto"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: "light",
|
|
87
|
+
label: "Light"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "dark",
|
|
91
|
+
label: "Dark"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
export { EmbedPanel };
|