likec4 1.2.2 → 1.4.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/dist/__app__/react/likec4.tsx +11 -13
- package/dist/__app__/src/lib/webcomponent.mjs +17428 -18376
- package/dist/__app__/src/main.mjs +37575 -1
- package/dist/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +291 -286
- package/package.json +22 -24
- package/react/LikeC4Browser.css.d.ts +1 -2
- package/react/LikeC4Browser.d.ts +1 -1
- package/react/LikeC4ViewElement.d.ts +1 -1
- package/react/ShadowRoot.d.ts +1 -3
- package/react/ShadowRootMantineProvider.d.ts +7 -0
- package/react/index.mjs +17285 -19048
- package/react/styles.d.ts +3 -2
- package/react/types.d.ts +0 -4
- package/dist/__app__/src/ViewAsReact-CowYtE-c.mjs +0 -15524
- package/dist/__app__/src/main-DMmXFqbw.mjs +0 -38682
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { LikeC4Browser, type LikeC4ViewBaseProps, LikeC4ViewElement
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
import { createPortal } from 'react-dom'
|
|
1
|
+
import { LikeC4Browser, type LikeC4ViewBaseProps, LikeC4ViewElement } from 'likec4/react'
|
|
2
|
+
import { useCallback, useState } from 'react'
|
|
4
3
|
import { isLikeC4ViewId, type LikeC4ViewId, LikeC4Views } from 'virtual:likec4/views'
|
|
5
4
|
|
|
6
5
|
export { isLikeC4ViewId }
|
|
7
|
-
|
|
8
6
|
export type LikeC4ViewProps = LikeC4ViewBaseProps<LikeC4ViewId>
|
|
9
7
|
|
|
10
8
|
export function LikeC4View({
|
|
@@ -12,7 +10,6 @@ export function LikeC4View({
|
|
|
12
10
|
interactive = true,
|
|
13
11
|
colorScheme,
|
|
14
12
|
injectFontCss = true,
|
|
15
|
-
overlay,
|
|
16
13
|
...props
|
|
17
14
|
}: LikeC4ViewProps) {
|
|
18
15
|
const view = LikeC4Views[viewId]
|
|
@@ -21,6 +18,10 @@ export function LikeC4View({
|
|
|
21
18
|
|
|
22
19
|
const browserView = browserViewId ? LikeC4Views[browserViewId] : null
|
|
23
20
|
|
|
21
|
+
const closeBrowser = useCallback(() => {
|
|
22
|
+
onNavigateTo(null)
|
|
23
|
+
}, [onNavigateTo])
|
|
24
|
+
|
|
24
25
|
if (!view) {
|
|
25
26
|
throw new Error(`View with id ${viewId} not found`)
|
|
26
27
|
}
|
|
@@ -31,26 +32,23 @@ export function LikeC4View({
|
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<>
|
|
34
|
-
<
|
|
35
|
+
<LikeC4ViewElement<LikeC4ViewId>
|
|
35
36
|
view={view}
|
|
36
37
|
colorScheme={colorScheme}
|
|
37
38
|
injectFontCss={injectFontCss}
|
|
38
39
|
onNavigateTo={interactive ? onNavigateTo : undefined}
|
|
39
40
|
{...props}
|
|
40
41
|
/>
|
|
41
|
-
{browserView && (
|
|
42
|
+
{browserView && (
|
|
42
43
|
<LikeC4Browser<LikeC4ViewId>
|
|
43
44
|
view={browserView}
|
|
44
45
|
injectFontCss={false}
|
|
45
46
|
colorScheme={colorScheme}
|
|
46
|
-
overlay={overlay}
|
|
47
47
|
onNavigateTo={onNavigateTo}
|
|
48
48
|
background="dots"
|
|
49
|
-
onClose={
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
view.id
|
|
53
|
-
))}
|
|
49
|
+
onClose={closeBrowser}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
54
52
|
</>
|
|
55
53
|
)
|
|
56
54
|
}
|