@likec4/diagram 1.25.1 → 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/dist/base/primitives/element/ElementNodeContainer.css.js +1 -0
- package/dist/base/primitives/element/ElementShape.css.js +0 -1
- package/dist/context/IconRenderer.d.ts +4 -2
- package/dist/context/IconRenderer.js +12 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/overlays/relationships-browser/-useRelationshipsView.d.ts +1 -1
- package/package.json +4 -4
- package/src/context/IconRenderer.tsx +22 -2
- package/src/index.ts +1 -0
- package/src/overlays/relationships-browser/-useRelationshipsView.ts +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ElementShape } from '@likec4/core';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
2
3
|
import { ElementIconRenderer } from '../LikeC4Diagram.props';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export declare function IconRendererProvider({ value, children, }: PropsWithChildren<{
|
|
5
|
+
value: ElementIconRenderer | null;
|
|
6
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export declare function IconRenderer({ element, className, }: {
|
|
6
8
|
element?: {
|
|
7
9
|
id: string;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { IconCylinder, IconRectangularPrism, IconReorder, IconUser, IconDeviceMobile, IconBrowser } from "@tabler/icons-react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import {
|
|
4
|
+
import { useContext, createContext } from "react";
|
|
5
5
|
const IconRendererContext = createContext(null);
|
|
6
|
-
|
|
6
|
+
function IconRendererProvider({
|
|
7
|
+
value,
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const outerScope = useContext(IconRendererContext);
|
|
11
|
+
if (outerScope) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(IconRendererContext.Provider, { value, children });
|
|
15
|
+
}
|
|
7
16
|
function IconRenderer({
|
|
8
17
|
element,
|
|
9
18
|
className
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { ControlsCustomLayout, ControlsCustomLayoutProps } from './context/ControlsCustomLayout';
|
|
2
2
|
export { FramerMotionConfig } from './context/FramerMotionConfig';
|
|
3
|
+
export { IconRendererProvider } from './context/IconRenderer';
|
|
3
4
|
export { LikeC4Diagram } from './LikeC4Diagram';
|
|
4
5
|
export type { LikeC4DiagramProps } from './LikeC4Diagram';
|
|
5
6
|
export { Overlay } from './overlays/overlay/Overlay';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { FramerMotionConfig } from "./context/FramerMotionConfig.js";
|
|
3
|
+
import { IconRendererProvider } from "./context/IconRenderer.js";
|
|
3
4
|
import { LikeC4Diagram } from "./LikeC4Diagram.js";
|
|
4
5
|
import { Overlay } from "./overlays/overlay/Overlay.js";
|
|
5
6
|
import { LikeC4ModelProvider } from "./LikeC4ModelProvider.js";
|
|
@@ -11,6 +12,7 @@ import { useLikeC4Model } from "./likec4model/useLikeC4Model.js";
|
|
|
11
12
|
import { vars, xyvars } from "./theme-vars.css.js";
|
|
12
13
|
export {
|
|
13
14
|
FramerMotionConfig,
|
|
15
|
+
IconRendererProvider,
|
|
14
16
|
LikeC4Diagram,
|
|
15
17
|
LikeC4ModelProvider,
|
|
16
18
|
Overlay,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DiagramEdge, DiagramNode, DiagramView, ElementKind, Fqn, ViewId } from '@likec4/core/types';
|
|
2
|
-
import { ElementModel, RelationshipModel } from '@likec4/core
|
|
2
|
+
import { ElementModel, RelationshipModel } from '@likec4/core';
|
|
3
3
|
import { RelationshipsBrowserTypes } from './_types';
|
|
4
4
|
export type RelationshipsViewData = {
|
|
5
5
|
incomers: ReadonlySet<ElementModel>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/diagram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"remeda": "^2.21.0",
|
|
58
58
|
"type-fest": "4.34.1",
|
|
59
59
|
"xstate": "^5.19.2",
|
|
60
|
-
"@likec4/core": "1.
|
|
60
|
+
"@likec4/core": "1.26.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@mantine/core": "7.17.1",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"typescript": "5.8.2",
|
|
79
79
|
"vite": "6.1.0",
|
|
80
80
|
"vite-plugin-dts": "^4.5.0",
|
|
81
|
-
"vitest": "^3.0.
|
|
81
|
+
"vitest": "^3.0.8",
|
|
82
82
|
"wireit": "^0.14.11",
|
|
83
|
-
"@likec4/tsconfig": "1.
|
|
83
|
+
"@likec4/tsconfig": "1.26.0"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"typecheck": "tsc --noEmit",
|
|
@@ -10,12 +10,32 @@ import {
|
|
|
10
10
|
IconUser,
|
|
11
11
|
} from '@tabler/icons-react'
|
|
12
12
|
import clsx from 'clsx'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type ForwardRefExoticComponent,
|
|
15
|
+
type PropsWithChildren,
|
|
16
|
+
type ReactNode,
|
|
17
|
+
type RefAttributes,
|
|
18
|
+
createContext,
|
|
19
|
+
useContext,
|
|
20
|
+
} from 'react'
|
|
14
21
|
import type { ElementIconRenderer } from '../LikeC4Diagram.props'
|
|
15
22
|
|
|
16
23
|
const IconRendererContext = createContext<ElementIconRenderer | null>(null)
|
|
17
24
|
|
|
18
|
-
export
|
|
25
|
+
export function IconRendererProvider({
|
|
26
|
+
value,
|
|
27
|
+
children,
|
|
28
|
+
}: PropsWithChildren<{ value: ElementIconRenderer | null }>) {
|
|
29
|
+
const outerScope = useContext(IconRendererContext)
|
|
30
|
+
if (outerScope) {
|
|
31
|
+
return <>{children}</>
|
|
32
|
+
}
|
|
33
|
+
return (
|
|
34
|
+
<IconRendererContext.Provider value={value}>
|
|
35
|
+
{children}
|
|
36
|
+
</IconRendererContext.Provider>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
19
39
|
|
|
20
40
|
export function IconRenderer({
|
|
21
41
|
element,
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import '@xyflow/react/dist/style.css'
|
|
|
2
2
|
|
|
3
3
|
export type { ControlsCustomLayout, ControlsCustomLayoutProps } from './context/ControlsCustomLayout'
|
|
4
4
|
export { FramerMotionConfig } from './context/FramerMotionConfig'
|
|
5
|
+
export { IconRendererProvider } from './context/IconRenderer'
|
|
5
6
|
export { LikeC4Diagram } from './LikeC4Diagram'
|
|
6
7
|
export type { LikeC4DiagramProps } from './LikeC4Diagram'
|
|
7
8
|
export { Overlay } from './overlays/overlay/Overlay'
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
import { useMemo } from 'react'
|
|
15
15
|
|
|
16
16
|
import dagre, { type EdgeConfig, type GraphLabel } from '@dagrejs/dagre'
|
|
17
|
+
import type { ElementModel, RelationshipModel } from '@likec4/core'
|
|
17
18
|
import {
|
|
18
19
|
DefaultMap,
|
|
19
20
|
invariant,
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
sortParentsFirst,
|
|
24
25
|
toArray,
|
|
25
26
|
} from '@likec4/core'
|
|
26
|
-
import type { ElementModel, RelationshipModel } from '@likec4/core/model'
|
|
27
27
|
import {
|
|
28
28
|
concat,
|
|
29
29
|
filter,
|