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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
The `specification` block defines all named vocabularies for the project: element kinds, deployment node kinds, relationship kinds, tags, and custom color tokens. Every kind used in `model` or `deployment` blocks must be declared here first.
|
|
4
4
|
|
|
5
5
|
**Key rules:**
|
|
6
|
+
|
|
6
7
|
- Specification is global across all files in the project.
|
|
7
8
|
- Duplicate identifiers (same kind, same tag, etc.) will cause a validation error.
|
|
8
9
|
- Multiple `specification` blocks (in one file or across files) are allowed, but not recommended.
|
|
@@ -34,7 +35,10 @@ specification {
|
|
|
34
35
|
relationship IDENTIFIER {
|
|
35
36
|
technology "default tech for this relationship kind"
|
|
36
37
|
description "default description for this relationship kind"
|
|
37
|
-
style
|
|
38
|
+
// default style properties go directly in the body, not in a style block
|
|
39
|
+
color amber
|
|
40
|
+
line dashed
|
|
41
|
+
head diamond
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
// Define a custom named color token
|
|
@@ -67,9 +71,9 @@ specification {
|
|
|
67
71
|
|
|
68
72
|
## Common Mistakes
|
|
69
73
|
|
|
70
|
-
| Mistake
|
|
71
|
-
|
|
72
|
-
| Using a kind not defined here
|
|
73
|
-
| Duplicate tag or kind identifier | Each identifier must be unique within its type category
|
|
74
|
-
| `#tag` in specification argument | Tags are defined without `#`; they are used with `#` elsewhere: `tag critical` → `#critical`
|
|
75
|
-
| Raw hex color in style
|
|
74
|
+
| Mistake | Fix |
|
|
75
|
+
| -------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
76
|
+
| Using a kind not defined here | Define `element KIND { }` or `deploymentNode KIND { }` in specification first |
|
|
77
|
+
| Duplicate tag or kind identifier | Each identifier must be unique within its type category |
|
|
78
|
+
| `#tag` in specification argument | Tags are defined without `#`; they are used with `#` elsewhere: `tag critical` → `#critical` |
|
|
79
|
+
| Raw hex color in style | Define a named color token first: `color my-blue #003366`, then use `color my-blue` in styles |
|
|
@@ -4,68 +4,73 @@ Load this file when encountering validation errors, unexpected rendering, or whe
|
|
|
4
4
|
|
|
5
5
|
## Syntax Errors
|
|
6
6
|
|
|
7
|
-
| Error
|
|
8
|
-
|
|
9
|
-
| "Identifier PAYMENT.API not found"
|
|
10
|
-
| "Unknown kind SERVICE"
|
|
11
|
-
| "Duplicate FQN cloud.backend"
|
|
12
|
-
| "Expected property TYPE after include *" | Malformed filter predicate
|
|
13
|
-
| "Invalid relationship kind async-cache"
|
|
7
|
+
| Error | Cause | Fix |
|
|
8
|
+
| ---------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------ |
|
|
9
|
+
| "Identifier PAYMENT.API not found" | Dots in identifier name | Use `payment-api` not `payment.api`; dots are FQN separators only |
|
|
10
|
+
| "Unknown kind SERVICE" | Kind not in specification | Define `element service { ... }` in the specification block |
|
|
11
|
+
| "Duplicate FQN cloud.backend" | Element ID repeated under the same parent | Rename one element; each sibling must have a unique identifier |
|
|
12
|
+
| "Expected property TYPE after include *" | Malformed filter predicate | Use `include * where kind is component`, not `include * component` |
|
|
13
|
+
| "Invalid relationship kind async-cache" | Kind not found in specification | Define `relationship async-cache { ... }` in specification first |
|
|
14
14
|
|
|
15
15
|
## Model & Hierarchy
|
|
16
16
|
|
|
17
|
-
| Error
|
|
18
|
-
|
|
19
|
-
| Element shows but relationships don't render
|
|
20
|
-
| "Can't define relationship from parent to child" | Direct parent-child relationships are forbidden
|
|
21
|
-
| Child element not visible from other files
|
|
22
|
-
| Extend block adds duplicate tags
|
|
17
|
+
| Error | Cause | Fix |
|
|
18
|
+
| ------------------------------------------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
19
|
+
| Element shows but relationships don't render | Relationship references FQN incorrectly | Use exact FQN matching the model hierarchy |
|
|
20
|
+
| "Can't define relationship from parent to child" | Direct parent-child relationships are forbidden | Move the relationship outside the parent element or use implicit notation |
|
|
21
|
+
| Child element not visible from other files | Referencing by short name instead of FQN | Import or use full FQN: `cloud.backend.api` |
|
|
22
|
+
| Extend block adds duplicate tags | Tags stack on merge | Use consistent tag names; duplicates are not deduplicated automatically |
|
|
23
|
+
| Warning `Element 'api' not found` on `[[api]]` | Markdown link target is not an absolute FQN of the current project | Use the full FQN: `[[cloud.backend.api]]`; imported elements cannot be linked |
|
|
24
|
+
| Warning `Unknown link namespace 'deployment'` | Only `view:` is a known prefix in `[[…]]` | Use `[[view:id]]` or an element FQN |
|
|
25
|
+
| `[[cloud.api]]` shows as raw text | Plain `'…'` string, or inside inline/fenced code | Use a Markdown value `'''…'''`; move the link out of code |
|
|
26
|
+
|
|
27
|
+
Labelled link breaks a Markdown table cell: a bare pipe splits GFM table cells, so inside tables write the separator as `\\|`, e.g. `[[cloud.api\\|API]]`.
|
|
23
28
|
|
|
24
29
|
## View Predicates
|
|
25
30
|
|
|
26
|
-
| Error
|
|
27
|
-
|
|
28
|
-
| `include *` shows grandchildren
|
|
29
|
-
| Relationships disappear in scoped view
|
|
30
|
-
| "WHERE predicate not matching any elements" | Tag or kind name is case-sensitive | Use exact case: `#Critical` ≠ `#critical`
|
|
31
|
-
| Element included but styled differently
|
|
31
|
+
| Error | Cause | Fix |
|
|
32
|
+
| ------------------------------------------- | ---------------------------------- | --------------------------------------------------------------------------------- |
|
|
33
|
+
| `include *` shows grandchildren | Confusing `*` with `**` | `*` = direct children only; use `**` for recursive descent |
|
|
34
|
+
| Relationships disappear in scoped view | Neighbors not explicitly included | Add `include -> scope` or `include <-> scope` to pull in inbound/outbound sources |
|
|
35
|
+
| "WHERE predicate not matching any elements" | Tag or kind name is case-sensitive | Use exact case: `#Critical` ≠ `#critical` |
|
|
36
|
+
| Element included but styled differently | Global vs. local style conflict | Local view styles override global; audit style rules order in the view block |
|
|
32
37
|
|
|
33
38
|
## Deployment
|
|
34
39
|
|
|
35
|
-
| Error
|
|
36
|
-
|
|
37
|
-
| `instanceOf` doesn't resolve
|
|
38
|
-
| "Undefined DEPLOYMENT_KIND"
|
|
40
|
+
| Error | Cause | Fix |
|
|
41
|
+
| --------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
42
|
+
| `instanceOf` doesn't resolve | Instance refers to wrong FQN | Use the exact logical model FQN, not the deployment node identifier |
|
|
43
|
+
| "Undefined DEPLOYMENT_KIND" | Kind referenced but not in specification | Define `deploymentNode vm { ... }` in specification |
|
|
39
44
|
| Deployment relationship inherits unexpectedly | Logical model edges are inherited automatically | Suppress inherited relationships explicitly in the deployment view if unwanted |
|
|
40
45
|
|
|
41
46
|
## Dynamic Views
|
|
42
47
|
|
|
43
|
-
| Error
|
|
44
|
-
|
|
45
|
-
| `Nested parallel blocks are not allowed`
|
|
46
|
-
| `"loop" can not be used as an alternative branch` | Non-branch block (`loop`/`opt`/`parallel`/`try`) placed directly inside `alt` | `alt` accepts only `when`/`if`/`else` branches; nest the block inside a branch
|
|
47
|
-
| `"when" alternative branch must be inside "alt"`
|
|
48
|
-
| `catch`/`finally` rejected
|
|
49
|
-
| Response arrows (`<-`) show wrong direction
|
|
50
|
-
| `navigateTo` link doesn't work
|
|
51
|
-
| `variant sequence` is ignored
|
|
48
|
+
| Error | Cause | Fix |
|
|
49
|
+
| ------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `Nested parallel blocks are not allowed` | Nested `parallel { parallel { ... } }` (or `par`) | Flatten: put all concurrent steps in a single `parallel { }` block. Other flow blocks (`opt`/`loop`/`try`/`alt`) may nest freely |
|
|
51
|
+
| `"loop" can not be used as an alternative branch` | Non-branch block (`loop`/`opt`/`parallel`/`try`) placed directly inside `alt` | `alt` accepts only `when`/`if`/`else` branches; nest the block inside a branch |
|
|
52
|
+
| `"when" alternative branch must be inside "alt"` | `when`/`if`/`else` used at top level or inside a non-`alt` block | Wrap the branches in an `alt { ... }` block |
|
|
53
|
+
| `catch`/`finally` rejected | `catch` without a preceding `try`, or `catch` after `finally` | Keep order `try` → `catch?` → `finally?` |
|
|
54
|
+
| Response arrows (`<-`) show wrong direction | Chained `<-` steps are not supported | After `a -> b -> c`, write one `<-` step per hop: `b <- c`, then `a <- b`. `<-` cannot be chained (`a <- b <- c` is a parse error) |
|
|
55
|
+
| `navigateTo` link doesn't work | Target view name does not exist | Ensure the target view name exists in the same project; from a dynamic step it must be another `dynamic view` |
|
|
56
|
+
| `variant sequence` is ignored | Wrong keyword or spelling | Use exact: `variant sequence` (not `type`, `mode`, or `sequence` alone) |
|
|
52
57
|
|
|
53
58
|
## Validation & Import
|
|
54
59
|
|
|
55
|
-
| Most Common
|
|
56
|
-
|
|
57
|
-
| `validate` reports config not found
|
|
58
|
-
| `Imported project not found`
|
|
59
|
-
| Symbol from import invisible in model
|
|
60
|
+
| Most Common | Solution |
|
|
61
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `validate` reports config not found | Ensure `likec4.config.json` exists in the project root directory |
|
|
63
|
+
| `Imported project not found` | `import` takes another project's `name` (from its `likec4.config`), not a file path: `import { x } from 'other-project'`. Files of the same project need no import; reference elements by full FQN |
|
|
64
|
+
| Symbol from import invisible in model | Symbol must be public (defined at top level); nested elements need FQN |
|
|
60
65
|
| Large error count in project but your file is clean | Use `likec4 validate --json --no-layout --file <edited-file> <project-dir>` and check `filteredErrors`/`filteredFiles`; text mode can also print diagnostics from other workspace files before the filtered summary |
|
|
61
66
|
|
|
62
67
|
## Performance & Large Models
|
|
63
68
|
|
|
64
|
-
| Symptom
|
|
65
|
-
|
|
66
|
-
| Validation takes >30s
|
|
67
|
-
| Export generates a partial PNG | Layout engine timeout on complex view
|
|
68
|
-
| IDE responsiveness slow
|
|
69
|
+
| Symptom | Cause | Action |
|
|
70
|
+
| ------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
71
|
+
| Validation takes >30s | Specification changes trigger full project re-parse | Keep specification in a separate file; avoid editing it frequently |
|
|
72
|
+
| Export generates a partial PNG | Layout engine timeout on complex view | Split large views with `navigateTo` or reduce the element count |
|
|
73
|
+
| IDE responsiveness slow | Too many open files or large specification in working file | Split into `spec.c4` + `model.c4` + `views.c4` |
|
|
69
74
|
|
|
70
75
|
## Debugging Workflow
|
|
71
76
|
|
|
@@ -216,10 +216,10 @@ customer
|
|
|
216
216
|
-> frontend "opens" // Read as "customer opens frontend"
|
|
217
217
|
-> backend "requests" // Read as "frontend requests backend"
|
|
218
218
|
-> database "queries" // Read as "backend queries database"
|
|
219
|
-
|
|
219
|
+
backend <- database "responds" // Read as "database responds to backend"
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
Each arrow in the chain creates a separate step. The target of the previous step becomes the source of the next.
|
|
222
|
+
Each arrow in the chain creates a separate step. The target of the previous step becomes the source of the next. A chain can continue with `->` or a relationship-kind arrow such as `-[kind]->`. A chain cannot continue with `<-`, so write a response as its own step.
|
|
223
223
|
|
|
224
224
|
## Parallel Steps
|
|
225
225
|
|
package/vite-plugin-modules.d.ts
CHANGED
|
@@ -33,25 +33,17 @@ declare module 'likec4:projects-overview' {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
declare module 'likec4:icons' {
|
|
36
|
-
import type {
|
|
37
|
-
|
|
38
|
-
export type ElementIconRendererProps = {
|
|
39
|
-
node: {
|
|
40
|
-
id: string
|
|
41
|
-
title: string
|
|
42
|
-
icon?: string | null | undefined
|
|
43
|
-
}
|
|
44
|
-
}
|
|
36
|
+
import type { ElementIconRenderer, ElementIconRendererProps } from 'likec4/react'
|
|
45
37
|
|
|
46
|
-
export type ElementIconRenderer
|
|
38
|
+
export type { ElementIconRenderer, ElementIconRendererProps }
|
|
47
39
|
export function getProjectIcons(projectId: string): ElementIconRenderer
|
|
48
40
|
}
|
|
49
41
|
|
|
50
42
|
declare module 'likec4:model' {
|
|
51
|
-
import type { DiagramView, LayoutedLikeC4ModelData, LikeC4Model, UnknownLayouted } from 'likec4/model'
|
|
43
|
+
import type { DiagramView, LayoutedLikeC4ModelData, LikeC4Model, UnknownLayouted, ViewId } from 'likec4/model'
|
|
52
44
|
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
53
45
|
|
|
54
|
-
export type { Atom, DiagramView, LayoutedLikeC4ModelData, LikeC4Model, UnknownLayouted }
|
|
46
|
+
export type { Atom, DiagramView, LayoutedLikeC4ModelData, LikeC4Model, UnknownLayouted, ViewId }
|
|
55
47
|
|
|
56
48
|
export function loadModel(projectId: string): Promise<{
|
|
57
49
|
$likec4data: Atom<LayoutedLikeC4ModelData>
|
|
@@ -59,6 +51,7 @@ declare module 'likec4:model' {
|
|
|
59
51
|
useLikeC4Model: () => LikeC4Model<UnknownLayouted>
|
|
60
52
|
useLikeC4Views: () => ReadonlyArray<DiagramView<UnknownLayouted>>
|
|
61
53
|
useLikeC4View: (viewId: string) => DiagramView<UnknownLayouted> | null
|
|
54
|
+
isLikeC4ViewId: (value: unknown) => value is ViewId
|
|
62
55
|
}>
|
|
63
56
|
}
|
|
64
57
|
|
|
@@ -69,15 +62,19 @@ declare module 'likec4:single-project' {
|
|
|
69
62
|
LikeC4Model,
|
|
70
63
|
types,
|
|
71
64
|
UnknownLayouted,
|
|
65
|
+
ViewId,
|
|
72
66
|
} from 'likec4/model'
|
|
73
67
|
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
74
68
|
import type { ElementIconRenderer } from 'likec4:icons'
|
|
75
69
|
|
|
70
|
+
export type { Atom, DiagramView, LayoutedLikeC4ModelData, LikeC4Model, UnknownLayouted, ViewId }
|
|
71
|
+
|
|
76
72
|
export const $likec4data: Atom<LayoutedLikeC4ModelData>
|
|
77
73
|
export const $likec4model: Atom<LikeC4Model<UnknownLayouted>>
|
|
78
74
|
export function useLikeC4Model(): LikeC4Model<UnknownLayouted>
|
|
79
75
|
export function useLikeC4Views(): ReadonlyArray<DiagramView<UnknownLayouted>>
|
|
80
76
|
export function useLikeC4View(viewId: string): DiagramView<UnknownLayouted> | null
|
|
77
|
+
export function isLikeC4ViewId(value: unknown): value is ViewId
|
|
81
78
|
|
|
82
79
|
export const IconRenderer: ElementIconRenderer
|
|
83
80
|
|
|
@@ -85,23 +82,39 @@ declare module 'likec4:single-project' {
|
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
declare module 'likec4:react' {
|
|
88
|
-
import type {
|
|
89
|
-
|
|
85
|
+
import type {
|
|
86
|
+
aux,
|
|
87
|
+
DiagramView,
|
|
88
|
+
LayoutedLikeC4ModelData,
|
|
89
|
+
LayoutedView,
|
|
90
|
+
LikeC4Model,
|
|
91
|
+
UnknownLayouted,
|
|
92
|
+
} from 'likec4/model'
|
|
93
|
+
import type { ElementIconRendererProps, LikeC4ViewProps, ReactLikeC4Props } from 'likec4/react'
|
|
90
94
|
import type { JSX, PropsWithChildren } from 'react'
|
|
95
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
export type { Atom, DiagramView, LayoutedView, LikeC4Model, UnknownLayouted }
|
|
98
|
+
|
|
99
|
+
// This will be used for augmenting the types
|
|
100
|
+
export interface Register {
|
|
94
101
|
}
|
|
102
|
+
export type $Types<T = Register> = T extends { aux: infer A extends aux.Any } ? A : UnknownLayouted
|
|
95
103
|
|
|
96
|
-
export type LikeC4ViewId = aux.ViewId
|
|
104
|
+
export type LikeC4ViewId = aux.ViewId<$Types>
|
|
97
105
|
|
|
98
|
-
export
|
|
99
|
-
export
|
|
100
|
-
export
|
|
106
|
+
// Re-export from likec4:model
|
|
107
|
+
export const $likec4data: Atom<LayoutedLikeC4ModelData<$Types>>
|
|
108
|
+
export const $likec4model: Atom<LikeC4Model<$Types>>
|
|
109
|
+
export function useLikeC4Model(): LikeC4Model<$Types>
|
|
110
|
+
export function useLikeC4Views(): ReadonlyArray<LayoutedView<$Types>>
|
|
111
|
+
export function useLikeC4View(viewId: LikeC4ViewId): LayoutedView<$Types> | null
|
|
112
|
+
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId
|
|
101
113
|
|
|
102
114
|
export function LikeC4ModelProvider(props: PropsWithChildren): JSX.Element
|
|
103
|
-
export function LikeC4View({ viewId, ...props }: LikeC4ViewProps
|
|
104
|
-
export function ReactLikeC4({ viewId, ...props }: ReactLikeC4Props
|
|
115
|
+
export function LikeC4View({ viewId, ...props }: LikeC4ViewProps<$Types>): JSX.Element
|
|
116
|
+
export function ReactLikeC4({ viewId, ...props }: ReactLikeC4Props<$Types>): JSX.Element
|
|
117
|
+
export function IconRenderer(props: ElementIconRendererProps): JSX.Element
|
|
105
118
|
}
|
|
106
119
|
|
|
107
120
|
declare module 'likec4:dot' {
|
|
@@ -130,56 +143,102 @@ declare module 'likec4:drawio' {
|
|
|
130
143
|
drawioEditUrl(this: void, viewId: string): string
|
|
131
144
|
}>
|
|
132
145
|
}
|
|
146
|
+
declare module 'likec4:diffs' {
|
|
147
|
+
import type { DiffSummary, LayoutedView } from 'likec4/model'
|
|
148
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Diffs of the project, with the compare views of the views they change (by diff id, then by view id)
|
|
152
|
+
*/
|
|
153
|
+
export interface ProjectDiffs {
|
|
154
|
+
diffs: DiffSummary[]
|
|
155
|
+
views: Record<string, Record<string, LayoutedView>>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function loadDiffs(projectId: string): Promise<{
|
|
159
|
+
$diffs: Atom<ProjectDiffs>
|
|
160
|
+
}>
|
|
161
|
+
}
|
|
133
162
|
|
|
134
163
|
// Per project
|
|
135
164
|
|
|
165
|
+
declare module 'likec4:diffs/*' {
|
|
166
|
+
import type { ProjectDiffs } from 'likec4:diffs'
|
|
167
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
168
|
+
|
|
169
|
+
export const $diffs: Atom<ProjectDiffs>
|
|
170
|
+
}
|
|
171
|
+
|
|
136
172
|
declare module 'likec4:model/*' {
|
|
137
|
-
import type {
|
|
138
|
-
|
|
173
|
+
import type {
|
|
174
|
+
aux,
|
|
175
|
+
DiagramView,
|
|
176
|
+
LayoutedLikeC4ModelData,
|
|
177
|
+
LayoutedView,
|
|
178
|
+
LikeC4Model,
|
|
179
|
+
UnknownLayouted,
|
|
180
|
+
} from 'likec4/model'
|
|
181
|
+
import type { ElementIconRendererProps, LikeC4ViewProps, ReactLikeC4Props } from 'likec4/react'
|
|
182
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
183
|
+
|
|
184
|
+
export type { Atom, DiagramView, LayoutedView, LikeC4Model, UnknownLayouted }
|
|
139
185
|
|
|
140
|
-
// This will be used
|
|
141
|
-
interface
|
|
186
|
+
// This will be used for augmenting the types
|
|
187
|
+
export interface Register {
|
|
142
188
|
}
|
|
189
|
+
export type $Types<T = Register> = T extends { aux: infer A extends aux.Any } ? A : UnknownLayouted
|
|
143
190
|
|
|
144
|
-
export type LikeC4ViewId = aux.ViewId
|
|
191
|
+
export type LikeC4ViewId = aux.ViewId<$Types>
|
|
145
192
|
|
|
146
|
-
export const $likec4data: Atom<LayoutedLikeC4ModelData
|
|
147
|
-
export const $likec4model: Atom<LikeC4Model
|
|
148
|
-
export function useLikeC4Model(): LikeC4Model
|
|
149
|
-
export function useLikeC4Views(): ReadonlyArray<
|
|
150
|
-
export function useLikeC4View(viewId: LikeC4ViewId):
|
|
193
|
+
export const $likec4data: Atom<LayoutedLikeC4ModelData<$Types>>
|
|
194
|
+
export const $likec4model: Atom<LikeC4Model<$Types>>
|
|
195
|
+
export function useLikeC4Model(): LikeC4Model<$Types>
|
|
196
|
+
export function useLikeC4Views(): ReadonlyArray<LayoutedView<$Types>>
|
|
197
|
+
export function useLikeC4View(viewId: LikeC4ViewId): LayoutedView<$Types> | null
|
|
198
|
+
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId
|
|
151
199
|
}
|
|
152
200
|
|
|
153
201
|
declare module 'likec4:icons/*' {
|
|
154
|
-
import type {
|
|
155
|
-
type ElementIconRendererProps
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
title: string
|
|
159
|
-
icon?: string | null | undefined
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
export function IconRenderer(props: ElementIconRendererProps): ReactNode
|
|
202
|
+
import type { JSX } from 'react'
|
|
203
|
+
import type { ElementIconRendererProps } from 'likec4/react'
|
|
204
|
+
|
|
205
|
+
export function IconRenderer(props: ElementIconRendererProps): JSX.Element
|
|
163
206
|
}
|
|
164
207
|
|
|
165
208
|
declare module 'likec4:react/*' {
|
|
166
|
-
import type {
|
|
167
|
-
|
|
209
|
+
import type {
|
|
210
|
+
aux,
|
|
211
|
+
DiagramView,
|
|
212
|
+
LayoutedLikeC4ModelData,
|
|
213
|
+
LayoutedView,
|
|
214
|
+
LikeC4Model,
|
|
215
|
+
UnknownLayouted,
|
|
216
|
+
} from 'likec4/model'
|
|
217
|
+
import type { ElementIconRendererProps, LikeC4ViewProps, ReactLikeC4Props } from 'likec4/react'
|
|
168
218
|
import type { JSX, PropsWithChildren } from 'react'
|
|
219
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
169
220
|
|
|
170
|
-
|
|
171
|
-
|
|
221
|
+
export type { Atom, DiagramView, LayoutedView, LikeC4Model, UnknownLayouted }
|
|
222
|
+
|
|
223
|
+
// This will be used for augmenting the types
|
|
224
|
+
export interface Register {
|
|
172
225
|
}
|
|
226
|
+
export type $Types<T = Register> = T extends { aux: infer A extends aux.Any } ? A : UnknownLayouted
|
|
173
227
|
|
|
174
|
-
export type LikeC4ViewId = aux.ViewId
|
|
228
|
+
export type LikeC4ViewId = aux.ViewId<$Types>
|
|
175
229
|
|
|
176
|
-
export
|
|
177
|
-
export
|
|
178
|
-
export
|
|
230
|
+
// Re-export from likec4:model
|
|
231
|
+
export const $likec4data: Atom<LayoutedLikeC4ModelData<$Types>>
|
|
232
|
+
export const $likec4model: Atom<LikeC4Model<$Types>>
|
|
233
|
+
export function useLikeC4Model(): LikeC4Model<$Types>
|
|
234
|
+
export function useLikeC4Views(): ReadonlyArray<LayoutedView<$Types>>
|
|
235
|
+
export function useLikeC4View(viewId: LikeC4ViewId): LayoutedView<$Types> | null
|
|
236
|
+
export function isLikeC4ViewId(value: unknown): value is LikeC4ViewId
|
|
179
237
|
|
|
180
238
|
export function LikeC4ModelProvider(props: PropsWithChildren): JSX.Element
|
|
181
|
-
export function LikeC4View({ viewId, ...props }: LikeC4ViewProps
|
|
182
|
-
export function ReactLikeC4({ viewId, ...props }: ReactLikeC4Props
|
|
239
|
+
export function LikeC4View({ viewId, ...props }: LikeC4ViewProps<$Types>): JSX.Element
|
|
240
|
+
export function ReactLikeC4({ viewId, ...props }: ReactLikeC4Props<$Types>): JSX.Element
|
|
241
|
+
export function IconRenderer(props: ElementIconRendererProps): JSX.Element
|
|
183
242
|
}
|
|
184
243
|
|
|
185
244
|
declare module 'likec4:webcomponents/*' {
|
|
@@ -207,6 +266,9 @@ declare module 'likec4:rpc' {
|
|
|
207
266
|
declare module 'likec4:app-config' {
|
|
208
267
|
export let ComponentName: {
|
|
209
268
|
View: string
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated
|
|
271
|
+
*/
|
|
210
272
|
Browser: string
|
|
211
273
|
}
|
|
212
274
|
export let pageTitle: string
|
|
@@ -217,3 +279,16 @@ declare module 'likec4:app-config' {
|
|
|
217
279
|
export let krokiD2SvgUrl: string
|
|
218
280
|
export let krokiPumlSvgUrl: string
|
|
219
281
|
}
|
|
282
|
+
|
|
283
|
+
declare module 'likec4:customization' {
|
|
284
|
+
import type { CustomComponents } from 'likec4/react'
|
|
285
|
+
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
286
|
+
|
|
287
|
+
export type { CustomComponents }
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* UI overrides from the file set in the `customization` option of the LikeC4 Vite plugin
|
|
291
|
+
*/
|
|
292
|
+
export const $customComponents: Atom<CustomComponents | undefined>
|
|
293
|
+
export function useCustomComponents(): CustomComponents | undefined
|
|
294
|
+
}
|