likec4 1.25.0 → 1.26.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/__app__/react/likec4.tsx +12 -28
- package/__app__/src/main.js +48928 -3
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +2 -16
- package/dist/cli/index.mjs +727 -1112
- package/dist/index.d.mts +11 -16022
- package/dist/index.d.ts +11 -16022
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -2
- package/dist/model/index.d.ts +2 -2
- package/dist/shared/likec4.C0X7XZt3.mjs +3682 -0
- package/dist/shared/likec4.Cz9mPeTQ.mjs +356 -0
- package/dist/shared/likec4.Y_4a6gTW.d.mts +2063 -0
- package/dist/shared/likec4.Y_4a6gTW.d.ts +2063 -0
- package/dist/vite-plugin/index.d.mts +48 -0
- package/dist/vite-plugin/index.d.ts +48 -0
- package/dist/vite-plugin/index.mjs +2 -0
- package/package.json +37 -24
- package/react/index.d.ts +17 -9
- package/react/index.js +6924 -5918
- package/react/{style.css → likec4.css} +1 -1
- package/vite-plugin-modules.d.ts +88 -0
- package/__app__/src/chunks/-index-overview-BQqR8e0d.js +0 -310
- package/__app__/src/chunks/-view-lazy-data-CI4xD57c.js +0 -9
- package/__app__/src/chunks/likec4-DRDnYFvy.js +0 -6150
- package/__app__/src/chunks/main-iM8EmCL0.js +0 -25402
- package/__app__/src/chunks/mantine-B7q9iXnB.js +0 -13363
- package/__app__/src/chunks/tanstack-router-MjA2OK6n.js +0 -2925
- package/__app__/src/icons.js +0 -9
- package/dist/shared/likec4.DX7xzn9M.mjs +0 -3608
- /package/__app__/src/{chunks/index-C6pszJh8.js → index-C6pszJh8.js} +0 -0
package/__app__/react/likec4.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DiagramView, ViewId } from '@likec4/core/types'
|
|
1
|
+
import type { ViewId } from '@likec4/core'
|
|
3
2
|
import {
|
|
4
3
|
type LikeC4ViewProps,
|
|
5
4
|
type ReactLikeC4Props as GenericReactLikeC4Props,
|
|
@@ -7,42 +6,27 @@ import {
|
|
|
7
6
|
LikeC4View as GenericLikeC4View,
|
|
8
7
|
ReactLikeC4 as GenericReactLikeC4,
|
|
9
8
|
} from 'likec4/react'
|
|
9
|
+
import { $likec4data, $likec4model, IconRenderer } from 'likec4:single-project'
|
|
10
10
|
import { type PropsWithChildren } from 'react'
|
|
11
|
-
import { Icons } from 'virtual:likec4/icons'
|
|
12
|
-
import { likeC4Model, LikeC4Views, useLikeC4Model } from 'virtual:likec4/model'
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
node: {
|
|
16
|
-
id: string
|
|
17
|
-
title: string
|
|
18
|
-
icon?: string | null | undefined
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function RenderIcon({ node }: IconRendererProps) {
|
|
23
|
-
const IconComponent = Icons[node.icon ?? '']
|
|
24
|
-
return IconComponent ? <IconComponent /> : null
|
|
25
|
-
}
|
|
12
|
+
export const likeC4Model = $likec4model.get()
|
|
26
13
|
|
|
27
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
IconRenderer as RenderIcon,
|
|
16
|
+
useLikeC4Model,
|
|
17
|
+
useLikeC4View,
|
|
18
|
+
} from 'likec4:single-project'
|
|
28
19
|
|
|
29
|
-
export function useLikeC4ViewModel(viewId: ViewId): LikeC4Model.View {
|
|
30
|
-
return useLikeC4Model().view(viewId as any)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function useLikeC4View(viewId: ViewId): DiagramView {
|
|
34
|
-
return useLikeC4Model().view(viewId as any).$view as DiagramView
|
|
35
|
-
}
|
|
36
20
|
export function isLikeC4ViewId(value: unknown): value is ViewId {
|
|
21
|
+
const model = $likec4data.get()
|
|
37
22
|
return (
|
|
38
23
|
value != null
|
|
39
24
|
&& typeof value === 'string'
|
|
40
|
-
&& value
|
|
25
|
+
&& !!model.views[value]
|
|
41
26
|
)
|
|
42
27
|
}
|
|
43
28
|
|
|
44
29
|
export function LikeC4ModelProvider({ children }: PropsWithChildren) {
|
|
45
|
-
const likeC4Model = useLikeC4Model()
|
|
46
30
|
return (
|
|
47
31
|
<GenericLikeC4ModelProvider likec4model={likeC4Model}>
|
|
48
32
|
{children}
|
|
@@ -54,7 +38,7 @@ export function LikeC4View(props: LikeC4ViewProps<string, string, string>) {
|
|
|
54
38
|
return (
|
|
55
39
|
<LikeC4ModelProvider>
|
|
56
40
|
<GenericLikeC4View
|
|
57
|
-
renderIcon={
|
|
41
|
+
renderIcon={IconRenderer}
|
|
58
42
|
{...props} />
|
|
59
43
|
</LikeC4ModelProvider>
|
|
60
44
|
)
|
|
@@ -66,7 +50,7 @@ export function ReactLikeC4(props: ReactLikeC4Props) {
|
|
|
66
50
|
return (
|
|
67
51
|
<LikeC4ModelProvider>
|
|
68
52
|
<GenericReactLikeC4
|
|
69
|
-
renderIcon={
|
|
53
|
+
renderIcon={IconRenderer}
|
|
70
54
|
{...props}
|
|
71
55
|
/>
|
|
72
56
|
</LikeC4ModelProvider>
|