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
@@ -1,10 +1,75 @@
1
1
  import { t as __name } from "./chunks/rolldown-runtime.mjs";
2
- import { LikeC4Model } from "@likec4/core/model";
3
2
  import { DependencyList } from "react";
3
+ import { LikeC4Model } from "@likec4/core/model";
4
4
  import { LayoutedElementView, LayoutedLikeC4ModelData, LayoutedView, ProjectId, ViewChange, ViewId } from "@likec4/core/types";
5
5
  import { AdhocViewPredicate } from "@likec4/core/compute-view";
6
- //#region ../vite-plugin/dist/internal/index.d.mts
7
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.d.ts
6
+ import "@likec4/core/builder";
7
+ import * as c4 from "@likec4/core";
8
+ import "zod/v4";
9
+ import "type-fest";
10
+ import "@likec4/core/utils";
11
+ import "@likec4/core/styles";
12
+ import "chokidar";
13
+ import "@tanstack/ai";
14
+ declare module 'langium' {
15
+ interface LangiumDocument {
16
+ likec4ProjectId?: c4.ProjectId;
17
+ }
18
+ interface AstNodeDescription {
19
+ likec4ProjectId?: c4.ProjectId;
20
+ }
21
+ }
22
+ declare const idattr: unique symbol;
23
+ declare module './generated/ast' {
24
+ interface Element {
25
+ [idattr]?: c4.Fqn | undefined;
26
+ }
27
+ interface ElementView {
28
+ [idattr]?: c4.ViewId | undefined;
29
+ }
30
+ interface DynamicView {
31
+ [idattr]?: c4.ViewId | undefined;
32
+ }
33
+ interface DeploymentView {
34
+ [idattr]?: c4.ViewId | undefined;
35
+ }
36
+ interface DeploymentNode {
37
+ [idattr]?: c4.Fqn | undefined;
38
+ }
39
+ interface DeployedInstance {
40
+ [idattr]?: c4.Fqn | undefined;
41
+ }
42
+ }
43
+ /**
44
+ * @hidden
45
+ */
46
+ declare type $keywords<T extends string> = { [key in T]: key; };
47
+ declare module 'ts-graphviz' {
48
+ namespace GraphAttributeKey {
49
+ interface $values extends $keywords<'likec4_viewId'> {}
50
+ }
51
+ namespace ClusterSubgraphAttributeKey {
52
+ interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {}
53
+ }
54
+ namespace NodeAttributeKey {
55
+ interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level'> {}
56
+ }
57
+ namespace EdgeAttributeKey {
58
+ interface $values extends $keywords<'likec4_id' | 'likec4_project'> {}
59
+ }
60
+ namespace Attribute {
61
+ interface $keys extends $keywords<'likec4_viewId' | 'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_project' | 'likec4_level' | 'likec4_depth'> {}
62
+ interface $types {
63
+ likec4_viewId: string;
64
+ likec4_type: 'folder' | 'file' | 'view';
65
+ likec4_path: string;
66
+ likec4_id: string;
67
+ likec4_project: string;
68
+ likec4_level: number;
69
+ likec4_depth: number;
70
+ }
71
+ }
72
+ }
8
73
  type AllKeys<T> = T extends any ? keyof T : never;
9
74
  type Primitive = boolean | number | string;
10
75
  type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends ((...args: any) => any) ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
@@ -143,8 +208,6 @@ type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>;
143
208
  * @returns The store object with methods to subscribe.
144
209
  */
145
210
  export declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [] | [Value] : [Value]): PreinitializedWritableAtom<Value> & StoreExt;
146
- //#endregion
147
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/map/index.d.ts
148
211
  type KeyofBase = keyof any;
149
212
  type Get<T, K extends KeyofBase> = T extends any ? K extends keyof T ? T[K] : never : never;
150
213
  type HasIndexSignature<T> = string extends keyof T ? true : false;
@@ -257,13 +320,9 @@ export declare function map<Value extends object, StoreExt extends object = obje
257
320
  * @returns The store object with methods to subscribe.
258
321
  */
259
322
  export declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Partial<Value>> & StoreExt;
260
- //#endregion
261
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/task/index.d.ts
262
323
  interface Task<Value> extends Promise<Value> {
263
324
  t: true;
264
325
  }
265
- //#endregion
266
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.d.ts
267
326
  type StoreValues<Stores extends readonly Gettable[]> = { -readonly [Index in keyof Stores]: StoreValue<Stores[Index]>; };
268
327
  interface Computed {
269
328
  /**
@@ -312,8 +371,6 @@ interface Batched {
312
371
  <Value, OriginStores extends readonly Store[]>(stores: readonly [...OriginStores], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
313
372
  }
314
373
  export declare const batched: Batched;
315
- //#endregion
316
- //#region src/rpc/protocol.d.ts
317
374
  interface LikeC4VitePluginRpc {
318
375
  /**
319
376
  * Apply semantic layout (if AI is available)
@@ -343,8 +400,6 @@ interface LikeC4VitePluginRpc {
343
400
  predicates: AdhocViewPredicate[];
344
401
  }): Promise<LayoutedElementView>;
345
402
  }
346
- //#endregion
347
- //#region ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.0/node_modules/@nanostores/react/index.d.ts
348
403
  type StoreKeys<T> = T extends {
349
404
  setKey: (k: infer K, v: any) => unknown;
350
405
  } ? K : never;
@@ -391,8 +446,27 @@ interface UseStoreOptions<SomeStore> {
391
446
  * @returns Store value.
392
447
  */
393
448
  export declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
394
- //#endregion
395
- //#region src/internal.d.ts
449
+ /**
450
+ * @deprecated Use {@link LikeC4AppOptions} at the top level of the plugin options
451
+ */
452
+ interface LikeC4AppConfig {
453
+ /**
454
+ * @deprecated Use `webcomponentPrefix` at the top level of the plugin options
455
+ */
456
+ webcomponentPrefix?: string;
457
+ /**
458
+ * @deprecated Use `title` at the top level of the plugin options
459
+ */
460
+ pageTitle?: string;
461
+ /**
462
+ * @deprecated Use `useHashHistory` at the top level of the plugin options
463
+ */
464
+ useHashHistory?: boolean | undefined;
465
+ /**
466
+ * @deprecated Use `theme` at the top level of the plugin options
467
+ */
468
+ theme?: 'light' | 'dark' | undefined;
469
+ }
396
470
  export interface LikeC4VitePluginRpcOptions {
397
471
  /**
398
472
  * Function to post raw message
@@ -414,6 +488,6 @@ export declare function createHooksForModel($atom: WritableAtom<LayoutedLikeC4Mo
414
488
  useLikeC4Model: () => LikeC4Model.Layouted;
415
489
  useLikeC4Views: () => ReadonlyArray<LayoutedView>;
416
490
  useLikeC4View: (viewId: string) => LayoutedView | null;
491
+ isLikeC4ViewId: (id: unknown) => id is string;
417
492
  };
418
- //#endregion
419
- export type { Atom, LikeC4VitePluginRpc, ReadableAtom, WritableAtom };
493
+ export type { Atom, LikeC4AppConfig, LikeC4VitePluginRpc, ReadableAtom, WritableAtom };
@@ -1,8 +1,8 @@
1
1
  import { t as __name } from "./chunks/rolldown-runtime.mjs";
2
- import { LikeC4Model } from "@likec4/core/model";
3
2
  import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
3
+ import { LikeC4Model as LikeC4Model$1 } from "@likec4/core/model";
4
4
 
5
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.js
5
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.js
6
6
  let listenerQueue = [];
7
7
  let lqIndex = 0;
8
8
  let batchSeen = null;
@@ -83,8 +83,7 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
83
83
  return $atom;
84
84
  };
85
85
 
86
- //#endregion
87
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js
86
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js
88
87
  const MOUNT = 5;
89
88
  const UNMOUNT = 6;
90
89
  const REVERT_MUTATION = 10;
@@ -144,8 +143,7 @@ let onMount = ($store, initialize) => {
144
143
  });
145
144
  };
146
145
 
147
- //#endregion
148
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.js
146
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.js
149
147
  let computedStore = (stores, cb, batched) => {
150
148
  if (!Array.isArray(stores)) stores = [stores];
151
149
  let previousArgs;
@@ -189,8 +187,7 @@ let computedStore = (stores, cb, batched) => {
189
187
  const computed = /* @__NO_SIDE_EFFECTS__ */ (stores, fn) => computedStore(stores, fn);
190
188
  const batched = /* @__NO_SIDE_EFFECTS__ */ (stores, fn) => computedStore(stores, fn, true);
191
189
 
192
- //#endregion
193
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/deep-map/path.js
190
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/deep-map/path.js
194
191
  function getPath(obj, path) {
195
192
  let allKeys = getAllKeysFromPath(path);
196
193
  let res = obj;
@@ -212,8 +209,7 @@ function getKeyAndIndicesFromKey(key) {
212
209
  return [key];
213
210
  }
214
211
 
215
- //#endregion
216
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/listen-keys/index.js
212
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/listen-keys/index.js
217
213
  function listenKeys($store, keys, listener) {
218
214
  let keysSet = new Set(keys);
219
215
  return $store.listen((value, oldValue, changed) => {
@@ -222,8 +218,7 @@ function listenKeys($store, keys, listener) {
222
218
  });
223
219
  }
224
220
 
225
- //#endregion
226
- //#region ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/map/index.js
221
+ // ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/map/index.js
227
222
  const map = /* @__NO_SIDE_EFFECTS__ */ (initial = {}) => {
228
223
  let $map = /* @__PURE__ */ atom(initial);
229
224
  $map.eqKey = Object.is;
@@ -244,8 +239,7 @@ const map = /* @__NO_SIDE_EFFECTS__ */ (initial = {}) => {
244
239
  return $map;
245
240
  };
246
241
 
247
- //#endregion
248
- //#region ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.0/node_modules/@nanostores/react/index.js
242
+ // ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.1/node_modules/@nanostores/react/index.js
249
243
  let emit = (snapshotRef, onChange) => (value) => {
250
244
  if (snapshotRef.current === value) return;
251
245
  snapshotRef.current = value;
@@ -264,8 +258,7 @@ function useStore(store, { keys, deps = [store, keys], ssr } = {}) {
264
258
  return useSyncExternalStore(subscribe, get, server);
265
259
  }
266
260
 
267
- //#endregion
268
- //#region ../../node_modules/.pnpm/birpc@4.2.0/node_modules/birpc/dist/index.mjs
261
+ // ../../node_modules/.pnpm/birpc@4.2.0/node_modules/birpc/dist/index.mjs
269
262
  function createPromiseWithResolvers() {
270
263
  let resolve;
271
264
  let reject;
@@ -463,12 +456,29 @@ function createBirpc($functions, options) {
463
456
  return rpc;
464
457
  }
465
458
 
466
- //#endregion
467
- //#region ../../node_modules/.pnpm/fast-equals@6.1.1/node_modules/fast-equals/dist/es/index.mjs
468
- const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
459
+ // ../../node_modules/.pnpm/fast-equals@6.2.2/node_modules/fast-equals/dist/es/index.mjs
460
+ const { getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols } = Object;
469
461
  const { hasOwnProperty, toString: toString$1 } = Object.prototype;
470
462
  const OBJECT_TAG = "[object Object]";
471
463
  /**
464
+ * Whether the own properties from `end` onward are equal with strict property checking, where the
465
+ * caller has already verified that both objects have the same number of own properties.
466
+ */
467
+ function areStrictPropertiesEqual(a, b, state, properties, end) {
468
+ let index = properties.length;
469
+ let property;
470
+ let descriptorA;
471
+ let descriptorB;
472
+ while (index-- > end) {
473
+ property = properties[index];
474
+ if (!isReactProperty(a, b, property) && (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state))) return false;
475
+ descriptorA = getOwnPropertyDescriptor(a, property);
476
+ descriptorB = getOwnPropertyDescriptor(b, property);
477
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
478
+ }
479
+ return true;
480
+ }
481
+ /**
472
482
  * Combine two comparators into a single comparators.
473
483
  */
474
484
  function combineComparators(comparatorA, comparatorB) {
@@ -505,6 +515,10 @@ function getStrictProperties(object) {
505
515
  return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
506
516
  }
507
517
  /**
518
+ * Identify the element type of TypedArrays across realms and subclasses.
519
+ */
520
+ const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
521
+ /**
508
522
  * Whether the object contains the property passed as an own property.
509
523
  */
510
524
  const hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
@@ -520,14 +534,32 @@ function isNullPrototypeComparable(a, b) {
520
534
  if (bConstructor == null) return aConstructor === Object || toString$1.call(a) === OBJECT_TAG;
521
535
  return false;
522
536
  }
523
- const PREACT_VNODE = "__v";
524
- const PREACT_OWNER = "__o";
525
- const REACT_OWNER = "_owner";
526
- const { getOwnPropertyDescriptor, keys } = Object;
527
537
  /**
528
- * Identify the element type of TypedArrays across realms and subclasses.
538
+ * Whether the property passed is a property specific to React/Preact elements. These are ignored in comparison, as they
539
+ * are deeply circular and will return frequent false negatives for the comparison that matters, which is often the
540
+ * React element's aspects (`props`, `type`, etc.).
529
541
  */
530
- const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
542
+ function isReactProperty(a, b, property) {
543
+ return (property === "_owner" || property === "__o" || property === "__v") && !!(a.$$typeof || b.$$typeof);
544
+ }
545
+ /**
546
+ * Reorder a serialized query string so that params holding the same pairs compare as equal
547
+ * regardless of the order they appear in.
548
+ *
549
+ * @note
550
+ * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
551
+ * splitting on `&` recovers exactly the pairs and nothing else.
552
+ */
553
+ function sortSearchParams(serialized) {
554
+ return serialized.split("&").sort().join("&");
555
+ }
556
+ /**
557
+ * Above this many keys, out-of-position keys are checked with `propertyIsEnumerable` rather than by
558
+ * scanning the other object's keys. Measured in V8: scanning wins up to 50 keys and loses from 100.
559
+ */
560
+ const MAX_SCANNED_PROPERTIES = 64;
561
+ const { keys } = Object;
562
+ const { propertyIsEnumerable } = Object.prototype;
531
563
  /**
532
564
  * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
533
565
  * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
@@ -583,13 +615,49 @@ function areDatesEqual(a, b) {
583
615
  *
584
616
  * @note
585
617
  * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
586
- * explicitly. `cause` is compared by value rather than by reference, matching how every other
587
- * nested value in the comparison is treated. Own enumerable properties (which custom `Error`
588
- * subclasses commonly add) are compared by composing this with the object comparator in the
589
- * comparator config, so that the strict and circular variants apply to them as well.
618
+ * explicitly. `cause` and `errors` are compared by value rather than by reference, matching how
619
+ * every other nested value in the comparison is treated. They are compared exactly once, regardless
620
+ * of whether they were assigned (enumerable) or set by the constructor (non-enumerable). Other own
621
+ * enumerable properties (which custom `Error` subclasses commonly add) are compared afterward.
622
+ *
623
+ * The own property comparison is inlined rather than extracted, which measured faster in V8 when
624
+ * recursing through `cause`. Keep the bytecode under V8's 460-byte TurboFan inlining limit (383 bytes
625
+ * at time of writing; check with `node --print-bytecode --print-bytecode-filter=areErrorsEqual`), or
626
+ * this stops being inlined into its callers.
590
627
  */
591
628
  function areErrorsEqual(a, b, state) {
592
- return a.name === b.name && a.message === b.message && a.stack === b.stack && state.equals(a.cause, b.cause, "cause", "cause", a, b, state);
629
+ if (a.name !== b.name || a.message !== b.message || a.stack !== b.stack) return false;
630
+ const causeA = a.cause;
631
+ const causeB = b.cause;
632
+ if (causeA !== causeB && !state.equals(causeA, causeB, "cause", "cause", a, b, state)) return false;
633
+ const errorsA = a.errors;
634
+ const errorsB = b.errors;
635
+ if (errorsA !== errorsB && !state.equals(errorsA, errorsB, "errors", "errors", a, b, state)) return false;
636
+ const propertiesA = keys(a);
637
+ const propertiesB = keys(b);
638
+ let index = propertiesA.length;
639
+ if (!index && !propertiesB.length) return true;
640
+ let compared = 0;
641
+ let property;
642
+ while (index-- > 0) {
643
+ property = propertiesA[index];
644
+ if (property === "cause" || property === "errors") continue;
645
+ if (property !== propertiesB[index] && !propertyIsEnumerable.call(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
646
+ ++compared;
647
+ }
648
+ const remaining = propertiesB.length - compared;
649
+ return !remaining || remaining === (propertyIsEnumerable.call(b, "cause") ? 1 : 0) + (propertyIsEnumerable.call(b, "errors") ? 1 : 0);
650
+ }
651
+ /**
652
+ * Whether the errors passed are equal in value.
653
+ *
654
+ * @note
655
+ * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
656
+ * explicitly. `cause` and `errors` are own properties, so `areObjectsEqualStrict` compares them along
657
+ * with every other own property; they are not compared explicitly to avoid comparing them twice.
658
+ */
659
+ function areErrorsEqualStrict(a, b, state) {
660
+ return a.name === b.name && a.message === b.message && a.stack === b.stack && areObjectsEqualStrict(a, b, state);
593
661
  }
594
662
  /**
595
663
  * Whether the `Map`s are equal in value.
@@ -598,7 +666,7 @@ function areMapsEqual(a, b, state) {
598
666
  const size = a.size;
599
667
  if (size !== b.size) return false;
600
668
  if (!size) return true;
601
- const matchedIndices = new Uint8Array(size);
669
+ const matchedIndices = new Array(size);
602
670
  const aIterable = a.entries();
603
671
  let aResult;
604
672
  let bResult;
@@ -606,7 +674,7 @@ function areMapsEqual(a, b, state) {
606
674
  while (aResult = aIterable.next()) {
607
675
  if (aResult.done) break;
608
676
  const bIterable = b.entries();
609
- let hasMatch = 0;
677
+ let hasMatch = false;
610
678
  let matchIndex = 0;
611
679
  while (bResult = bIterable.next()) {
612
680
  if (bResult.done) break;
@@ -617,7 +685,7 @@ function areMapsEqual(a, b, state) {
617
685
  const aEntry = aResult.value;
618
686
  const bEntry = bResult.value;
619
687
  if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
620
- hasMatch = matchedIndices[matchIndex] = 1;
688
+ hasMatch = matchedIndices[matchIndex] = true;
621
689
  break;
622
690
  }
623
691
  matchIndex++;
@@ -632,9 +700,16 @@ function areMapsEqual(a, b, state) {
632
700
  */
633
701
  function areObjectsEqual(a, b, state) {
634
702
  const properties = keys(a);
703
+ const propertiesB = keys(b);
635
704
  let index = properties.length;
636
- if (keys(b).length !== index) return false;
637
- while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
705
+ if (propertiesB.length !== index) return false;
706
+ const isScannable = index <= MAX_SCANNED_PROPERTIES;
707
+ let property;
708
+ while (index-- > 0) {
709
+ property = properties[index];
710
+ if (isReactProperty(a, b, property)) continue;
711
+ if (property !== propertiesB[index] && !(isScannable ? propertiesB.includes(property) : propertyIsEnumerable.call(b, property)) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
712
+ }
638
713
  return true;
639
714
  }
640
715
  /**
@@ -642,19 +717,7 @@ function areObjectsEqual(a, b, state) {
642
717
  */
643
718
  function areObjectsEqualStrict(a, b, state) {
644
719
  const properties = getStrictProperties(a);
645
- let index = properties.length;
646
- if (getStrictProperties(b).length !== index) return false;
647
- let property;
648
- let descriptorA;
649
- let descriptorB;
650
- while (index-- > 0) {
651
- property = properties[index];
652
- if (!isPropertyEqual(a, b, state, property)) return false;
653
- descriptorA = getOwnPropertyDescriptor(a, property);
654
- descriptorB = getOwnPropertyDescriptor(b, property);
655
- if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
656
- }
657
- return true;
720
+ return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, 0);
658
721
  }
659
722
  /**
660
723
  * Whether the primitive wrappers passed are equal in value.
@@ -669,25 +732,38 @@ function areRegExpsEqual(a, b) {
669
732
  return a.source === b.source && a.flags === b.flags;
670
733
  }
671
734
  /**
735
+ * Whether the search params passed are equal in value.
736
+ *
737
+ * @note
738
+ * Order is not significant, matching how the other unordered collections in the library are
739
+ * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
740
+ * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
741
+ */
742
+ function areSearchParamsEqual(a, b) {
743
+ const serializedA = a.toString();
744
+ const serializedB = b.toString();
745
+ return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
746
+ }
747
+ /**
672
748
  * Whether the `Set`s are equal in value.
673
749
  */
674
750
  function areSetsEqual(a, b, state) {
675
751
  const size = a.size;
676
752
  if (size !== b.size) return false;
677
753
  if (!size) return true;
678
- const matchedIndices = new Uint8Array(size);
754
+ const matchedIndices = new Array(size);
679
755
  const aIterable = a.values();
680
756
  let aResult;
681
757
  let bResult;
682
758
  while (aResult = aIterable.next()) {
683
759
  if (aResult.done) break;
684
760
  const bIterable = b.values();
685
- let hasMatch = 0;
761
+ let hasMatch = false;
686
762
  let matchIndex = 0;
687
763
  while (bResult = bIterable.next()) {
688
764
  if (bResult.done) break;
689
765
  if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
690
- hasMatch = matchedIndices[matchIndex] = 1;
766
+ hasMatch = matchedIndices[matchIndex] = true;
691
767
  break;
692
768
  }
693
769
  matchIndex++;
@@ -711,39 +787,24 @@ function areTypedArraysEqual(a, b) {
711
787
  return true;
712
788
  }
713
789
  /**
714
- * Whether the URL instances are equal in value.
715
- */
716
- function areUrlsEqual(a, b) {
717
- if (a.href === b.href) return true;
718
- return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
719
- }
720
- /**
721
- * Whether the search params passed are equal in value.
790
+ * Whether the TypedArray instances are equal in value with strict property checking.
722
791
  *
723
792
  * @note
724
- * Order is not significant, matching how the other unordered collections in the library are
725
- * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
726
- * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
793
+ * Indexed elements are also own properties, listed first and in order, with descriptors fixed by the
794
+ * spec. They are compared once by `areTypedArraysEqual`, so only the own properties after them
795
+ * (including symbols) are compared with strict property checking.
727
796
  */
728
- function areSearchParamsEqual(a, b) {
729
- const serializedA = a.toString();
730
- const serializedB = b.toString();
731
- return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
797
+ function areTypedArraysEqualStrict(a, b, state) {
798
+ if (!areTypedArraysEqual(a, b)) return false;
799
+ const properties = getStrictProperties(a);
800
+ return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, a.length);
732
801
  }
733
802
  /**
734
- * Reorder a serialized query string so that params holding the same pairs compare as equal
735
- * regardless of the order they appear in.
736
- *
737
- * @note
738
- * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
739
- * splitting on `&` recovers exactly the pairs and nothing else.
803
+ * Whether the URL instances are equal in value.
740
804
  */
741
- function sortSearchParams(serialized) {
742
- return serialized.split("&").sort().join("&");
743
- }
744
- function isPropertyEqual(a, b, state, property) {
745
- if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
746
- return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
805
+ function areUrlsEqual(a, b) {
806
+ if (a.href === b.href) return true;
807
+ return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
747
808
  }
748
809
  const { toString } = Object.prototype;
749
810
  /**
@@ -812,8 +873,8 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
812
873
  areArrayBuffersEqual,
813
874
  areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
814
875
  areDataViewsEqual,
815
- areDatesEqual,
816
- areErrorsEqual: strict ? combineComparators(areErrorsEqual, areObjectsEqualStrict) : combineComparators(areErrorsEqual, areObjectsEqual),
876
+ areDatesEqual: strict ? combineComparators(areDatesEqual, areObjectsEqualStrict) : areDatesEqual,
877
+ areErrorsEqual: strict ? areErrorsEqualStrict : areErrorsEqual,
817
878
  areFunctionsEqual: strictEqual,
818
879
  areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
819
880
  areNumbersEqual: sameValueEqual,
@@ -821,7 +882,7 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
821
882
  arePrimitiveWrappersEqual,
822
883
  areRegExpsEqual,
823
884
  areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
824
- areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
885
+ areTypedArraysEqual: strict ? areTypedArraysEqualStrict : areTypedArraysEqual,
825
886
  areUrlsEqual,
826
887
  getUnsupportedCustomComparator: void 0,
827
888
  strictNullPrototypeComparison
@@ -829,16 +890,20 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict,
829
890
  if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
830
891
  if (circular) {
831
892
  const areArraysEqual = createIsCircular(config.areArraysEqual);
893
+ const areDatesEqual = strict ? createIsCircular(config.areDatesEqual) : config.areDatesEqual;
832
894
  const areErrorsEqual = createIsCircular(config.areErrorsEqual);
833
895
  const areMapsEqual = createIsCircular(config.areMapsEqual);
834
896
  const areObjectsEqual = createIsCircular(config.areObjectsEqual);
835
897
  const areSetsEqual = createIsCircular(config.areSetsEqual);
898
+ const areTypedArraysEqual = strict ? createIsCircular(config.areTypedArraysEqual) : config.areTypedArraysEqual;
836
899
  config = Object.assign({}, config, {
837
900
  areArraysEqual,
901
+ areDatesEqual,
838
902
  areErrorsEqual,
839
903
  areMapsEqual,
840
904
  areObjectsEqual,
841
- areSetsEqual
905
+ areSetsEqual,
906
+ areTypedArraysEqual
842
907
  });
843
908
  }
844
909
  return config;
@@ -987,28 +1052,13 @@ function createCustomEqual(options = {}) {
987
1052
  });
988
1053
  }
989
1054
 
990
- //#endregion
991
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/lazyDataLastImpl--3B10z3s.js
992
- function e(e, t, n) {
993
- let r = (n) => e(n, ...t);
994
- return n === void 0 ? r : Object.assign(r, {
995
- lazy: n,
996
- lazyArgs: t
997
- });
998
- }
1055
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/dataLastImplementation-D-BXl-Tn.js
1056
+ const e = (e, t) => t.length === 1 ? (n) => e(n, t[0]) : (n) => e(n, ...t);
999
1057
 
1000
- //#endregion
1001
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/purry.js
1002
- function t$1(t, n, r) {
1003
- let i = t.length - n.length;
1004
- if (i === 0) return t(...n);
1005
- if (i === 1) return e(t, n, r);
1006
- throw Error(`Wrong number of arguments`);
1007
- }
1008
- __name(t$1, "t");
1058
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/purry.js
1059
+ const t$1 = /* @__PURE__ */ __name((t, n) => n.length >= t.length ? t(...n) : e(t, n), "t");
1009
1060
 
1010
- //#endregion
1011
- //#region ../../node_modules/.pnpm/remeda@2.51.0/node_modules/remeda/dist/mapValues.js
1061
+ // ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/mapValues.js
1012
1062
  function t(...t) {
1013
1063
  return t$1(n, t);
1014
1064
  }
@@ -1018,11 +1068,7 @@ function n(e, t) {
1018
1068
  return n;
1019
1069
  }
1020
1070
 
1021
- //#endregion
1022
- //#region ../vite-plugin/src/internal.ts
1023
- /**
1024
- * This module is used by the Vite plugin to generate the virtual modules
1025
- */
1071
+ // ../vite-plugin/src/internal.ts
1026
1072
  /**
1027
1073
  * Create a PluginRPC instance for the LikeC4 Vite plugin
1028
1074
  * used by the Vite plugin in virtual modules
@@ -1044,7 +1090,7 @@ function createRpc(options) {
1044
1090
  });
1045
1091
  }
1046
1092
  function createHooksForModel($atom) {
1047
- const $likec4model = /* @__PURE__ */ computed($atom, (data) => LikeC4Model.create(data));
1093
+ const $likec4model = /* @__PURE__ */ computed($atom, (data) => LikeC4Model$1.create(data));
1048
1094
  function updateModel(data) {
1049
1095
  const current = $atom.get();
1050
1096
  const next = {
@@ -1073,9 +1119,9 @@ function createHooksForModel($atom) {
1073
1119
  $likec4model,
1074
1120
  useLikeC4Model,
1075
1121
  useLikeC4Views,
1076
- useLikeC4View
1122
+ useLikeC4View,
1123
+ isLikeC4ViewId: (id) => typeof id === "string" && Object.hasOwn($atom.get().views, id)
1077
1124
  };
1078
1125
  }
1079
1126
 
1080
- //#endregion
1081
1127
  export { atom, batched, computed, createHooksForModel, createRpc, map, useStore };