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.
Files changed (157) hide show
  1. package/README.md +2 -0
  2. package/__app__/codegen/react.mjs +4 -10
  3. package/__app__/codegen/webcomponent.mjs +5 -208
  4. package/__app__/index.html +15 -15
  5. package/__app__/src/aichat/index.mjs +1 -2
  6. package/__app__/src/chunks/AIChat.mjs +292 -117
  7. package/__app__/src/chunks/ErrorComponent.mjs +444 -0
  8. package/__app__/src/chunks/Header.mjs +269 -0
  9. package/__app__/src/chunks/ViewReact.mjs +438 -0
  10. package/__app__/src/chunks/find.mjs +38 -0
  11. package/__app__/src/chunks/hooks.mjs +18 -541
  12. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
  13. package/__app__/src/chunks/libs/@tanstack-ai.mjs +11101 -1797
  14. package/__app__/src/chunks/libs/@tanstack.mjs +4563 -3083
  15. package/__app__/src/chunks/libs/fast-equals.mjs +140 -71
  16. package/__app__/src/chunks/{es.mjs → libs/html-to-image.mjs} +16 -22
  17. package/__app__/src/chunks/libs/nanostores.mjs +4 -8
  18. package/__app__/src/chunks/libs/react-resizable-panels.mjs +2792 -0
  19. package/__app__/src/chunks/react.mjs +22 -0
  20. package/__app__/src/chunks/rolldown-runtime.mjs +3 -32
  21. package/__app__/src/chunks/router.mjs +106 -0
  22. package/__app__/src/chunks/scope.mjs +106 -0
  23. package/__app__/src/chunks/searchParams.mjs +29 -0
  24. package/__app__/src/chunks/single-index.mjs +465 -0
  25. package/__app__/src/chunks/styled-system.mjs +1916 -2946
  26. package/__app__/src/chunks/useAsync.mjs +69 -0
  27. package/__app__/src/chunks/useSyncedRef.mjs +16 -0
  28. package/__app__/src/components/ColorSchemeToggle.mjs +124 -0
  29. package/__app__/src/components/CopyToClipboard.mjs +53 -0
  30. package/__app__/src/components/ErrorComponent.mjs +1 -0
  31. package/__app__/src/components/NavigationPanel.mjs +63 -0
  32. package/__app__/src/components/NotFound.mjs +155 -0
  33. package/__app__/src/components/ViewOutlet.mjs +9 -0
  34. package/__app__/src/components/model-diff/CompareModelProvider.mjs +44 -0
  35. package/__app__/src/components/model-diff/ModelDiffPanel.mjs +179 -0
  36. package/__app__/src/components/model-diff/compare-model.mjs +76 -0
  37. package/__app__/src/components/model-diff/state.mjs +45 -0
  38. package/__app__/src/components/search/OverviewSearch.mjs +92 -0
  39. package/__app__/src/components/search/OverviewSearchAdapter.mjs +94 -0
  40. package/__app__/src/components/sidebar/DiagramTree.css.mjs +48 -0
  41. package/__app__/src/components/sidebar/DiagramsTree.mjs +304 -0
  42. package/__app__/src/components/sidebar/Drawer.mjs +178 -0
  43. package/__app__/src/components/sidebar/SidebarBurger.mjs +28 -0
  44. package/__app__/src/components/sidebar/data.mjs +94 -0
  45. package/__app__/src/components/sidebar/state.mjs +16 -0
  46. package/__app__/src/components/view-page/Header.mjs +1 -0
  47. package/__app__/src/components/view-page/SelectProject.mjs +258 -0
  48. package/__app__/src/components/view-page/ShareModal.mjs +111 -0
  49. package/__app__/src/components/view-page/share-modal/AlertLocalhost.mjs +31 -0
  50. package/__app__/src/components/view-page/share-modal/CopyButtonChild.mjs +36 -0
  51. package/__app__/src/components/view-page/share-modal/EmbedPanel.mjs +100 -0
  52. package/__app__/src/components/view-page/share-modal/WebcomponentsPanel.mjs +264 -0
  53. package/__app__/src/components/view-page/state.mjs +17 -0
  54. package/__app__/src/context/LikeC4CustomizationContext.mjs +26 -0
  55. package/__app__/src/context/LikeC4IconRendererContext.mjs +29 -0
  56. package/__app__/src/context/LikeC4ModelContext.mjs +34 -0
  57. package/__app__/src/context/LikeC4ProjectsContext.mjs +40 -0
  58. package/__app__/src/context/ModelDiffsContext.mjs +33 -0
  59. package/__app__/src/context/safeCtx.mjs +14 -0
  60. package/__app__/src/hooks.mjs +1 -0
  61. package/__app__/src/main.mjs +4 -48126
  62. package/__app__/src/pages/EmbedPage.mjs +93 -0
  63. package/__app__/src/pages/ExportPage.mjs +691 -0
  64. package/__app__/src/pages/ProjectsOverview.mjs +23 -0
  65. package/__app__/src/pages/ViewAsD2.mjs +105 -0
  66. package/__app__/src/pages/ViewAsDot.mjs +65 -0
  67. package/__app__/src/pages/ViewAsMmd.mjs +109 -0
  68. package/__app__/src/pages/ViewAsPuml.mjs +105 -0
  69. package/__app__/src/pages/ViewEditor.mjs +220 -0
  70. package/__app__/src/pages/ViewReact.mjs +1 -0
  71. package/__app__/src/pages/export-layout.mjs +95 -0
  72. package/__app__/src/pages/export-page-params.mjs +9 -0
  73. package/__app__/src/pages/styles.css.mjs +23 -0
  74. package/__app__/src/routeTree.gen.mjs +105 -0
  75. package/__app__/src/router.mjs +1 -0
  76. package/__app__/src/routes/__root.mjs +65 -0
  77. package/__app__/src/routes/index.css.mjs +29 -0
  78. package/__app__/src/routes/index.mjs +32 -0
  79. package/__app__/src/routes/project._projectId/-components.mjs +100 -0
  80. package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
  81. package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
  82. package/__app__/src/routes/project._projectId/index.mjs +14 -0
  83. package/__app__/src/routes/project._projectId/route.mjs +93 -0
  84. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
  85. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
  86. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
  87. package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
  88. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
  89. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
  90. package/__app__/src/routes/projects.mjs +36 -0
  91. package/__app__/src/routes/single-index.mjs +1 -0
  92. package/__app__/src/routes/webcomponent._.mjs +94 -0
  93. package/__app__/src/style.css +1156 -1147
  94. package/config/schema.json +26 -2
  95. package/dist/app/render-view-client.css +1 -1
  96. package/dist/app/render-view-client.js +375 -393
  97. package/dist/chunks/filenames.mjs +26 -20
  98. package/dist/chunks/generate-likec4.mjs +4 -4
  99. package/dist/chunks/index.d.mts +16 -15
  100. package/dist/chunks/index2.d.mts +7041 -3293
  101. package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
  102. package/dist/chunks/libs/@logtape/logtape.mjs +5 -5
  103. package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
  104. package/dist/chunks/libs/chevrotain.mjs +19 -19
  105. package/dist/chunks/libs/clone.mjs +1 -0
  106. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  107. package/dist/chunks/libs/fast-equals.mjs +1 -0
  108. package/dist/chunks/libs/fontkit.mjs +1 -0
  109. package/dist/chunks/libs/langium.d.mts +80 -2933
  110. package/dist/chunks/libs/langium.mjs +6 -6
  111. package/dist/chunks/libs/pako.mjs +1 -1
  112. package/dist/chunks/libs/pathe.mjs +1 -1
  113. package/dist/chunks/libs/remeda.mjs +1 -1
  114. package/dist/chunks/node.mjs +110 -77
  115. package/dist/chunks/rolldown-runtime.mjs +1 -1
  116. package/dist/chunks/sequence-view.mjs +1 -1
  117. package/dist/chunks/vite-plugin.mjs +183 -164
  118. package/dist/cli/index.mjs +157 -101
  119. package/dist/config/index.d.mts +65 -4
  120. package/dist/config/index.mjs +1 -1
  121. package/dist/generators/likec4.d.mts +16 -64
  122. package/dist/index.d.mts +2 -4
  123. package/dist/model/index.d.mts +0 -10
  124. package/dist/vite-plugin/index.d.mts +83 -61
  125. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -2
  126. package/dist/vite-plugin/internal/index.d.mts +91 -17
  127. package/dist/vite-plugin/internal/index.mjs +156 -110
  128. package/package.json +60 -55
  129. package/react/index.d.mts +3010 -4014
  130. package/react/index.mjs +170 -171
  131. package/react/rolldown-runtime-CfRud99p.js +1 -0
  132. package/skills/likec4-dsl/SKILL.md +71 -25
  133. package/skills/likec4-dsl/evals/evals-public.json +5 -0
  134. package/skills/likec4-dsl/evals/grading-spec.json +15 -1
  135. package/skills/likec4-dsl/references/cli.md +39 -10
  136. package/skills/likec4-dsl/references/configuration.md +5 -5
  137. package/skills/likec4-dsl/references/diffs.md +52 -0
  138. package/skills/likec4-dsl/references/examples.md +2 -2
  139. package/skills/likec4-dsl/references/identifier-validity.md +31 -31
  140. package/skills/likec4-dsl/references/include-predicates-wildcards.md +16 -15
  141. package/skills/likec4-dsl/references/model.md +42 -11
  142. package/skills/likec4-dsl/references/specification.md +11 -7
  143. package/skills/likec4-dsl/references/troubleshooting.md +47 -42
  144. package/skills/likec4-dsl/references/views.md +2 -2
  145. package/vite-plugin-modules.d.ts +126 -51
  146. package/__app__/src/chunks/LikeC4Styles.mjs +0 -4522
  147. package/__app__/src/chunks/ProjectsOverview.mjs +0 -827
  148. package/__app__/src/chunks/libs/@floating-ui.mjs +0 -3286
  149. package/__app__/src/chunks/libs/@mantine.mjs +0 -17731
  150. package/__app__/src/chunks/libs/@xstate/react.mjs +0 -3471
  151. package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -7927
  152. package/__app__/src/chunks/libs/bezier-js.mjs +0 -1593
  153. package/__app__/src/chunks/libs/d3.mjs +0 -4531
  154. package/__app__/src/chunks/libs/framer.mjs +0 -11331
  155. package/__app__/src/chunks/libs/zod.mjs +0 -5404
  156. package/dist/chunks/libs/@chevrotain/types.d.mts +0 -111
  157. package/react/rolldown-runtime-DnkiqaRY.js +0 -1
package/README.md CHANGED
@@ -94,6 +94,8 @@ likec4 build -o ./dist
94
94
 
95
95
  Demo - [https://template.likec4.dev](https://template.likec4.dev/view/boutique/)
96
96
 
97
+ The options of `start`, `build` and other commands can be kept in a `likec4.app.config.ts` file instead of flags (experimental), see [App config](https://likec4.dev/tooling/app-config/).
98
+
97
99
  > **Tip:**\
98
100
  > [likec4/template](https://github.com/likec4/template) repository demonstrates how to deploy to github pages.
99
101
 
@@ -1,10 +1,4 @@
1
- import "../src/chunks/rolldown-runtime.mjs";
2
- import { $likec4model, IconRenderer as RenderIcon } from "likec4:single-project";
3
- import { LikeC4ModelProvider, LikeC4View, ReactLikeC4, useLikeC4Model, useLikeC4View } from "likec4:react";
4
- //#region codegen/react.tsx
5
- var likec4model = $likec4model.get();
6
- function isLikeC4ViewId(value) {
7
- return value != null && typeof value === "string" && !!likec4model.findView(value);
8
- }
9
- //#endregion
10
- export { LikeC4ModelProvider, LikeC4View, ReactLikeC4, RenderIcon, isLikeC4ViewId, likec4model, useLikeC4Model, useLikeC4View };
1
+ import { $likec4data, $likec4model, $likec4model as $likec4model$1, IconRenderer as RenderIcon, LikeC4ModelProvider, LikeC4View, ReactLikeC4, isLikeC4ViewId, useLikeC4Model, useLikeC4View } from "likec4:react";
2
+ // codegen/react.tsx
3
+ var likec4model = $likec4model$1.get();
4
+ export { $likec4data, $likec4model, LikeC4ModelProvider, LikeC4View, ReactLikeC4, RenderIcon, isLikeC4ViewId, likec4model, useLikeC4Model, useLikeC4View };
@@ -1,209 +1,6 @@
1
- import "../src/chunks/rolldown-runtime.mjs";
2
- import { C as safeParseAsync, D as normalizeParams, E as installLazyProp, O as own, S as safeParse, T as clone, _ as $ZodPipe, b as parse, d as $ZodBoolean, f as $ZodCodec, g as $ZodOptional, h as $ZodObject, k as shallowClone, l as _string, m as $ZodLiteral, p as $ZodDefault, u as _stringbool, v as $ZodString, w as $constructor, x as parseAsync, y as $ZodType } from "../src/chunks/libs/zod.mjs";
3
- import { createRoot } from "react-dom/client";
4
- import { jsx } from "react/jsx-runtime";
5
1
  import { ComponentName } from "likec4:app-config";
6
- import { LikeC4View as LikeC4View$1 } from "likec4:react";
7
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/schemas.js
8
- var ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
9
- if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
10
- $ZodType.init(inst, def);
11
- inst.def = def;
12
- inst.type = def.type;
13
- }, {
14
- get with() {
15
- return this.check;
16
- },
17
- set with(value) {
18
- own(this, "with", value);
19
- },
20
- parse(data, params) {
21
- return parse(this, data, params, { callee: this.parse });
22
- },
23
- parseAsync(data, params) {
24
- return parseAsync(this, data, params, { callee: this.parseAsync });
25
- },
26
- safeParse(data, params) {
27
- return safeParse(this, data, params);
28
- },
29
- safeParseAsync(data, params) {
30
- return safeParseAsync(this, data, params);
31
- },
32
- check(...checks) {
33
- const def = this.def;
34
- return this.clone({
35
- ...def,
36
- checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
37
- check: ch,
38
- def: { check: "custom" },
39
- onattach: []
40
- } } : ch)]
41
- }, { parent: true });
42
- },
43
- clone(_def, params) {
44
- return clone(this, _def, params);
45
- },
46
- brand() {
47
- return this;
48
- },
49
- register(reg, meta) {
50
- reg.add(this, meta);
51
- return this;
52
- },
53
- apply(fn, ...args) {
54
- return args.length === 0 ? fn(this) : fn(this, ...args);
55
- }
56
- });
57
- var ZodMiniString = /*@__PURE__*/ $constructor("ZodMiniString", (inst, def) => {
58
- $ZodString.init(inst, def);
59
- ZodMiniType.init(inst, def);
60
- });
61
- // @__NO_SIDE_EFFECTS__
62
- function string(params) {
63
- return _string(ZodMiniString, params);
64
- }
65
- var ZodMiniBoolean = /*@__PURE__*/ $constructor("ZodMiniBoolean", (inst, def) => {
66
- $ZodBoolean.init(inst, def);
67
- ZodMiniType.init(inst, def);
68
- });
69
- var ZodMiniObject = /*@__PURE__*/ $constructor("ZodMiniObject", (inst, def) => {
70
- $ZodObject.init(inst, def);
71
- ZodMiniType.init(inst, def);
72
- installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
73
- });
74
- // @__NO_SIDE_EFFECTS__
75
- function object(shape, params) {
76
- return new ZodMiniObject({
77
- type: "object",
78
- shape: shape ?? {},
79
- ...normalizeParams(params)
80
- });
81
- }
82
- var ZodMiniLiteral = /*@__PURE__*/ $constructor("ZodMiniLiteral", (inst, def) => {
83
- $ZodLiteral.init(inst, def);
84
- ZodMiniType.init(inst, def);
85
- });
86
- // @__NO_SIDE_EFFECTS__
87
- function literal(value, params) {
88
- return new ZodMiniLiteral({
89
- type: "literal",
90
- values: Array.isArray(value) ? value : [value],
91
- ...normalizeParams(params)
92
- });
93
- }
94
- var ZodMiniOptional = /*@__PURE__*/ $constructor("ZodMiniOptional", (inst, def) => {
95
- $ZodOptional.init(inst, def);
96
- ZodMiniType.init(inst, def);
97
- });
98
- // @__NO_SIDE_EFFECTS__
99
- function optional(innerType) {
100
- return new ZodMiniOptional({
101
- type: "optional",
102
- innerType
103
- });
104
- }
105
- var ZodMiniDefault = /*@__PURE__*/ $constructor("ZodMiniDefault", (inst, def) => {
106
- $ZodDefault.init(inst, def);
107
- ZodMiniType.init(inst, def);
108
- });
109
- // @__NO_SIDE_EFFECTS__
110
- function _default(innerType, defaultValue) {
111
- return new ZodMiniDefault({
112
- type: "default",
113
- innerType,
114
- get defaultValue() {
115
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
116
- }
117
- });
118
- }
119
- var ZodMiniPipe = /*@__PURE__*/ $constructor("ZodMiniPipe", (inst, def) => {
120
- $ZodPipe.init(inst, def);
121
- ZodMiniType.init(inst, def);
122
- });
123
- var ZodMiniCodec = /*@__PURE__*/ $constructor("ZodMiniCodec", (inst, def) => {
124
- ZodMiniPipe.init(inst, def);
125
- $ZodCodec.init(inst, def);
126
- });
127
- var stringbool = (...args) => _stringbool({
128
- Codec: ZodMiniCodec,
129
- Boolean: ZodMiniBoolean,
130
- String: ZodMiniString
131
- }, ...args);
132
- //#endregion
133
- //#region codegen/webcomponent.tsx
134
- var propsSchema = /* @__PURE__ */ object({
135
- viewId: /* @__PURE__ */ _default(/* @__PURE__ */ string(), "index"),
136
- browser: /* @__PURE__ */ _default(stringbool(), true),
137
- dynamicViewVariant: /* @__PURE__ */ optional(/* @__PURE__ */ literal(["diagram", "sequence"])),
138
- colorScheme: /* @__PURE__ */ optional(/* @__PURE__ */ literal(["light", "dark"]))
139
- });
140
- var LikeC4View = class extends HTMLElement {
141
- shadow;
142
- root;
143
- hostCss;
144
- lastHostCss = "";
145
- constructor() {
146
- super();
147
- this.shadow = this.attachShadow({
148
- mode: "open",
149
- delegatesFocus: true
150
- });
151
- }
152
- updateHostCss() {
153
- const hostCss = `
154
- :host {
155
- display: contents;
156
- background-color: transparent;
157
- margin: 0;
158
- padding: 0;
159
- }`;
160
- if (hostCss !== this.lastHostCss) {
161
- this.hostCss?.replaceSync(hostCss);
162
- this.lastHostCss = hostCss;
163
- }
164
- }
165
- connectedCallback() {
166
- this.lastHostCss = "";
167
- this.hostCss = new CSSStyleSheet();
168
- this.updateHostCss();
169
- this.shadow.adoptedStyleSheets = [this.hostCss];
170
- this.render();
171
- }
172
- disconnectedCallback() {
173
- this.root?.unmount();
174
- this.root = void 0;
175
- this.shadow.adoptedStyleSheets.length = 0;
176
- this.hostCss = void 0;
177
- }
178
- static observedAttributes = [
179
- "view-id",
180
- "browser",
181
- "dynamic-variant",
182
- "color-scheme"
183
- ];
184
- getProps() {
185
- const props = propsSchema.safeParse({
186
- viewId: this.getAttribute("view-id"),
187
- browser: this.getAttribute("browser") ?? void 0,
188
- dynamicViewVariant: this.getAttribute("dynamic-variant") ?? void 0,
189
- colorScheme: this.getAttribute("color-scheme") ?? void 0
190
- });
191
- if (!props.success) {
192
- console.error("Invalid props", props.error);
193
- return { viewId: "index" };
194
- }
195
- return props.data;
196
- }
197
- render() {
198
- const props = this.getProps();
199
- this.updateHostCss();
200
- this.root ??= createRoot(this.shadow);
201
- this.root.render(/* @__PURE__ */ jsx(LikeC4View$1, { ...props }));
202
- }
203
- attributeChangedCallback(_name) {
204
- if (this.root) this.render();
205
- }
206
- };
207
- customElements.define(ComponentName.View, LikeC4View);
208
- //#endregion
209
- export { LikeC4View };
2
+ import { defineLikeC4Webcomponent } from "likec4/react";
3
+ import { LikeC4View } from "likec4:react";
4
+ import { projectId } from "likec4:single-project";
5
+ // codegen/webcomponent.tsx
6
+ defineLikeC4Webcomponent(ComponentName.View, LikeC4View, projectId);
@@ -1,19 +1,19 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en-US">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
8
+ />
9
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg">
10
+ <link rel="stylesheet" href="/src/fonts.css">
11
+ <link rel="stylesheet" href="/src/style.css">
12
+ <title>LikeC4</title>
13
+ </head>
3
14
 
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport"
7
- content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" />
8
- <link rel="icon" type="image/svg+xml" href="/favicon.svg">
9
- <link rel="stylesheet" href="/src/fonts.css">
10
- <link rel="stylesheet" href="/src/style.css">
11
- <title>LikeC4</title>
12
- </head>
13
-
14
- <body>
15
- <div id="likec4-root"></div>
16
- <script type="module" src="/src/main"></script>
17
- </body>
18
-
15
+ <body>
16
+ <div id="likec4-root"></div>
17
+ <script type="module" src="/src/main"></script>
18
+ </body>
19
19
  </html>
@@ -2,12 +2,11 @@ import "../chunks/rolldown-runtime.mjs";
2
2
  import { Suspense, lazy } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { isAIAvailable } from "likec4:rpc";
5
- //#region src/aichat/index.tsx
5
+ // src/aichat/index.tsx
6
6
  var AIChat = /* @__PURE__ */ lazy(() => import("../chunks/AIChat.mjs"));
7
7
  /**
8
8
  * AI Chat component that is conditionally rendered based on AI availability
9
9
  * Uses lazy loading to avoid importing AI components in environments where AI is not available
10
10
  */
11
11
  var LazyAIChat = isAIAvailable ? () => /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(AIChat, {}) }) : () => null;
12
- //#endregion
13
12
  export { LazyAIChat };