@likec4/diagram 1.59.2 → 1.59.4
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 +53 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +36 -21
- package/dist/LikeC4Diagram.props.d.ts +23 -0
- package/dist/LikeC4MantineProvider.d.ts +24 -0
- package/dist/LikeC4MantineProvider.js +156 -0
- package/dist/LikeC4ProjectsOverview.js +1 -1
- package/dist/LikeC4ProjectsProvider.d.ts +17 -2
- package/dist/LikeC4Styles.d.ts +13 -3
- package/dist/LikeC4Styles.js +10 -6
- package/dist/LikeC4View.js +2 -2
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +19 -9
- package/dist/base/const.d.ts +1 -0
- package/dist/base/const.js +3 -1
- package/dist/base-primitives/Markdown.d.ts +3 -3
- package/dist/base-primitives/compound/CompoundNodeContainer.js +2 -3
- package/dist/base-primitives/compound/CompoundTitle.js +5 -4
- package/dist/base-primitives/compound/actionbtns.css.d.ts +3 -3
- package/dist/base-primitives/compound/actionbtns.css.js +3 -3
- package/dist/base-primitives/element/ElementData.js +6 -1
- package/dist/base-primitives/element/ElementShape.js +9 -10
- package/dist/base-primitives/element/ElementTags.d.ts +2 -2
- package/dist/base-primitives/element/ElementTags.js +5 -5
- package/dist/components/EmptyBox.d.ts +3 -0
- package/dist/components/EmptyBox.js +9 -0
- package/dist/components/ErrorFallback.js +7 -6
- package/dist/components/FloatingWindow.d.ts +18 -0
- package/dist/components/FloatingWindow.js +89 -0
- package/dist/components/Link.js +7 -7
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -6
- package/dist/components/SearchControl.css.js +10 -12
- package/dist/components/ViewIcon.d.ts +11 -0
- package/dist/components/ViewIcon.js +71 -0
- package/dist/context/CurrentViewModelProvider.js +2 -1
- package/dist/context/DiagramEventHandlers.js +4 -2
- package/dist/context/EnsureMantine.js +3 -3
- package/dist/context/IconRenderer.d.ts +2 -1
- package/dist/context/IconRenderer.js +78 -26
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/TagStylesContext.d.ts +11 -4
- package/dist/context/TagStylesContext.js +39 -27
- package/dist/custom/index.d.ts +3 -0
- package/dist/custom/index.js +7 -4
- package/dist/editor/LikeC4EditorCallbacks.d.ts +20 -1
- package/dist/editor/LikeC4EditorCallbacks.js +4 -1
- package/dist/editor/actor/setup.d.ts +1 -0
- package/dist/editor/actor/setup.js +17 -12
- package/dist/editor/actor/state.sync-queue.js +1 -0
- package/dist/editor/applyChangesToManualLayout.js +5 -2
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/useEditorActorLogic.js +10 -3
- package/dist/hooks/safeContext.d.ts +12 -4
- package/dist/hooks/safeContext.js +2 -2
- package/dist/hooks/useCurrentView.js +5 -5
- package/dist/hooks/useDiagram.js +3 -23
- package/dist/hooks/useDiagramCompareLayout.d.ts +16 -6
- package/dist/hooks/useDiagramCompareLayout.js +20 -17
- package/dist/hooks/useEditorActor.js +3 -5
- package/dist/hooks/useLikeC4Model.js +8 -3
- package/dist/hooks/useLikeC4Project.d.ts +4 -3
- package/dist/hooks/useOverlaysActor.d.ts +1 -1
- package/dist/hooks/useUpdateEffect.js +2 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +8 -6
- package/dist/likec4diagram/DiagramUI.js +4 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +6 -0
- package/dist/likec4diagram/DiagramXYFlow.js +33 -19
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +2 -4
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +1 -3
- package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +3 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +4 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +2 -2
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +8 -5
- package/dist/likec4diagram/custom/nodes/nodes.js +8 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -8
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +3 -2
- package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/components.js +6 -2
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +7 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +20 -4
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +1 -6
- package/dist/likec4diagram/state/diagram-api.d.ts +2 -2
- package/dist/likec4diagram/state/diagram-api.js +3 -2
- package/dist/likec4diagram/state/machine.actions.js +15 -8
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +7 -5
- package/dist/likec4diagram/state/machine.setup.d.ts +10 -1
- package/dist/likec4diagram/state/machine.setup.js +15 -9
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +2 -26
- package/dist/likec4diagram/state/machine.state.initializing.js +9 -6
- package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
- package/dist/likec4diagram/state/machine.state.ready.d.ts +134 -3
- package/dist/likec4diagram/state/machine.state.ready.js +2 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +106 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +40 -7
- package/dist/likec4diagram/state/utils.d.ts +1 -1
- package/dist/likec4diagram/state/utils.js +7 -4
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +2 -1
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +16 -10
- package/dist/likec4diagram/ui/index.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -15
- package/dist/likec4diagram/ui/notation/NotationPanel.js +9 -9
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.js +81 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.d.ts +11 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.js +70 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.js +106 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.js +140 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.d.ts +17 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.js +83 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +4 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +49 -525
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.d.ts +8 -0
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.js +52 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.d.ts +7 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.js +190 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.d.ts +238 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.js +94 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.d.ts +21 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.js +71 -0
- package/dist/likec4diagram/ui/sequence-outline/index.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.d.ts +13 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.js +21 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.d.ts +10 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.js +80 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.js +67 -0
- package/dist/likec4diagram/ui/sequence-outline/{state.d.ts → types.d.ts} +4 -2
- package/dist/likec4diagram/ui/sequence-outline/types.js +12 -0
- package/dist/likec4diagram/useLayoutConstraints.js +13 -1
- package/dist/likec4diagram/xyflow-sequence/layouter.js +8 -10
- package/dist/likec4diagram/xyflow-sequence/sequence-view-to-xy.js +1 -0
- package/dist/likec4diagram/xyflow-sequence/utils.js +0 -1
- package/dist/navigationpanel/NavigationPanel.js +45 -41
- package/dist/navigationpanel/NavigationPanelControls.js +102 -63
- package/dist/navigationpanel/NavigationPanelDropdown.js +52 -77
- package/dist/navigationpanel/_common.d.ts +6 -6
- package/dist/navigationpanel/_common.js +31 -42
- package/dist/navigationpanel/actor.actions.js +6 -5
- package/dist/navigationpanel/actor.js +2 -2
- package/dist/navigationpanel/actor.setup.d.ts +6 -6
- package/dist/navigationpanel/actor.setup.js +2 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -4
- package/dist/navigationpanel/comparepanel/ComparePanel.js +8 -10
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +11 -9
- package/dist/navigationpanel/controls/LayoutWarning.js +69 -72
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +8 -8
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
- package/dist/navigationpanel/controls/OpenSource.js +5 -8
- package/dist/navigationpanel/controls/SearchControl.js +24 -9
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +4 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +56 -76
- package/dist/navigationpanel/controls/ViewDetailsButton.d.ts +5 -0
- package/dist/navigationpanel/controls/ViewDetailsButton.js +121 -0
- package/dist/navigationpanel/controls/index.d.ts +1 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +27 -16
- package/dist/navigationpanel/editorpanel/ApplySemanticLayout.js +2 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +12 -10
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -10
- package/dist/navigationpanel/editorpanel/styles.js +8 -15
- package/dist/navigationpanel/hooks.d.ts +6 -2
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +0 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -4
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +10 -39
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.d.ts +1 -0
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.js +49 -0
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +8 -8
- package/dist/navigationpanel/windows/ViewDetailsWindow.d.ts +1 -0
- package/dist/navigationpanel/windows/ViewDetailsWindow.js +379 -0
- package/dist/overlays/Overlays.js +29 -17
- package/dist/overlays/element-details/ElementDetailsCard.css.js +28 -36
- package/dist/overlays/element-details/ElementDetailsCard.js +3 -3
- package/dist/overlays/element-details/MetadataValue.js +18 -16
- package/dist/overlays/element-details/TabPanelDeployments.css.js +6 -14
- package/dist/overlays/element-details/TabPanelRelationships.css.js +8 -12
- package/dist/overlays/element-details/TabPanelStructure.css.js +4 -8
- package/dist/overlays/hooks.d.ts +3 -1
- package/dist/overlays/overlay/Overlay.js +8 -7
- package/dist/overlays/overlaysActor.js +20 -17
- package/dist/overlays/relationship-details/RelationshipDetails.js +2 -1
- package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationship-details/hooks.js +2 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +15 -8
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -8
- package/dist/overlays/relationships-browser/SelectElement.js +5 -1
- package/dist/overlays/relationships-browser/actor.js +3 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.js +39 -38
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
- package/dist/overlays/relationships-browser/hooks.js +2 -1
- package/dist/projects-overview/ProjectsOverview.js +8 -7
- package/dist/projects-overview/actor.js +1 -1
- package/dist/projects-overview/hooks.js +2 -1
- package/dist/search/Search.js +9 -7
- package/dist/search/components/ElementsColumn.css.js +6 -5
- package/dist/search/components/ElementsColumn.js +4 -3
- package/dist/search/components/SearchByTags.js +3 -3
- package/dist/search/components/ViewsColum.js +46 -43
- package/dist/search/components/ViewsColumn.css.js +4 -4
- package/dist/search/components/_shared.css.d.ts +2 -2
- package/dist/search/components/_shared.css.js +31 -46
- package/dist/search/components/styles.css.js +4 -4
- package/dist/search/hooks.js +2 -1
- package/dist/shadowroot/ShadowRoot.js +6 -5
- package/dist/styles2.js +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +29 -29
- package/panda.buildinfo.json +342 -299
- package/styles-min.css +1 -1
- package/styles-xyflow.css +1 -1
- package/styles.css +1 -1
- package/dist/context/DefaultMantineProvider.d.ts +0 -2
- package/dist/context/DefaultMantineProvider.js +0 -48
- package/dist/likec4diagram/ui/sequence-outline/state.js +0 -55
- package/dist/navigationpanel/controls/DetailsControls.d.ts +0 -2
- package/dist/navigationpanel/controls/DetailsControls.js +0 -223
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RichTextOrEmpty as RichTextType } from '@likec4/core/types';
|
|
2
|
-
import { JsxStyleProps } from '
|
|
2
|
+
import { JsxStyleProps } from '@likec4/styles/types';
|
|
3
3
|
import { ComponentPropsWithoutRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, RefAttributes } from 'react';
|
|
4
|
-
export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color'> & {
|
|
4
|
+
export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySetInnerHTML' | 'children' | 'color' | 'translate'> & {
|
|
5
5
|
value: RichTextType;
|
|
6
6
|
/**
|
|
7
7
|
* When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
|
|
@@ -29,7 +29,7 @@ export type MarkdownProps = Omit<ComponentPropsWithoutRef<'div'>, 'dangerouslySe
|
|
|
29
29
|
*/
|
|
30
30
|
emptyText?: string;
|
|
31
31
|
};
|
|
32
|
-
export declare const Markdown: ForwardRefExoticComponent<Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "children" | "dangerouslySetInnerHTML"> & {
|
|
32
|
+
export declare const Markdown: ForwardRefExoticComponent<Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "translate" | "children" | "dangerouslySetInnerHTML"> & {
|
|
33
33
|
value: RichTextType;
|
|
34
34
|
/**
|
|
35
35
|
* When markdown block is used inside a diagram node, this variant should be used to apply the likec4 palette.
|
|
@@ -13,10 +13,9 @@ function CompoundNodeContainer({ nodeProps: { data: { hovered: isHovered = false
|
|
|
13
13
|
max: 100
|
|
14
14
|
});
|
|
15
15
|
const isTransparent = opacity < 98;
|
|
16
|
-
const
|
|
17
|
-
const borderOpacity = MIN_OPACITY + clamp((100 - MIN_OPACITY) * (opacity / 100), {
|
|
16
|
+
const borderOpacity = 50 + clamp(50 * (opacity / 100), {
|
|
18
17
|
min: 0,
|
|
19
|
-
max:
|
|
18
|
+
max: 50
|
|
20
19
|
});
|
|
21
20
|
const compoundClass = compoundNode({
|
|
22
21
|
isTransparent,
|
|
@@ -3,13 +3,14 @@ import { IconRenderer } from "../../context/IconRenderer.js";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/base-primitives/compound/CompoundTitle.tsx
|
|
5
5
|
function CompoundTitle({ data, "aria-hidden": ariaHidden }) {
|
|
6
|
+
const elementIcon = IconRenderer({
|
|
7
|
+
element: data,
|
|
8
|
+
className: "likec4-compound-icon"
|
|
9
|
+
});
|
|
6
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
11
|
className: "likec4-compound-title-container",
|
|
8
12
|
"aria-hidden": ariaHidden,
|
|
9
|
-
children: [
|
|
10
|
-
element: data,
|
|
11
|
-
className: "likec4-compound-icon"
|
|
12
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
13
|
+
children: [elementIcon, /* @__PURE__ */ jsx("div", {
|
|
13
14
|
className: "likec4-compound-title",
|
|
14
15
|
children: data.title
|
|
15
16
|
})]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RecipeRuntimeFn } from '
|
|
1
|
+
import { RecipeRuntimeFn } from '@likec4/styles/types';
|
|
2
2
|
export declare const compoundActionBtn: RecipeRuntimeFn<{
|
|
3
3
|
delay: {
|
|
4
4
|
true: {
|
|
5
5
|
transitionDelay: {
|
|
6
|
-
base: "0.2s";
|
|
7
|
-
_hover: "
|
|
6
|
+
base: "[0.2s]";
|
|
7
|
+
_hover: "0";
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { cva } from "@likec4/styles/css";
|
|
2
2
|
//#region src/base-primitives/compound/actionbtns.css.ts
|
|
3
3
|
var compoundActionBtn = cva({
|
|
4
|
-
base: { transitionDuration: "
|
|
4
|
+
base: { transitionDuration: "medium" },
|
|
5
5
|
variants: { delay: { true: { transitionDelay: {
|
|
6
|
-
base: "0.2s",
|
|
7
|
-
_hover: "
|
|
6
|
+
base: "[0.2s]",
|
|
7
|
+
_hover: "0"
|
|
8
8
|
} } } }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
@@ -22,16 +22,21 @@ var resolveIconColor = (styles, data) => {
|
|
|
22
22
|
const colors = styles.colors(iconColor).elements;
|
|
23
23
|
return iconColor === data.color ? colors.stroke : colors.fill;
|
|
24
24
|
};
|
|
25
|
+
function shouldBlendIconWithPalette(icon, hasIconColor) {
|
|
26
|
+
return !hasIconColor && icon?.startsWith("bootstrap:") === true;
|
|
27
|
+
}
|
|
25
28
|
var Root = forwardRef(({ className, style, data, ...props }, ref) => {
|
|
26
29
|
const styles = useLikeC4Styles();
|
|
27
30
|
const iconSize = data.style.iconSize ? styles.nodeSizes(data.style).values.iconSize : void 0;
|
|
28
31
|
const resolvedIconColor = resolveIconColor(styles, data);
|
|
32
|
+
const hasIconColor = !!resolvedIconColor;
|
|
29
33
|
return /* @__PURE__ */ jsx("div", {
|
|
30
34
|
...props,
|
|
31
35
|
ref,
|
|
32
36
|
className: cx(className, elementNodeData({
|
|
33
37
|
iconPosition: data.style.iconPosition,
|
|
34
|
-
withIconColor:
|
|
38
|
+
withIconColor: hasIconColor,
|
|
39
|
+
withIconBlend: shouldBlendIconWithPalette(data.icon, hasIconColor)
|
|
35
40
|
}), "likec4-element"),
|
|
36
41
|
style: {
|
|
37
42
|
...style,
|
|
@@ -22,7 +22,8 @@ function cylinderSVGPath(diameter, height, tilt = .07) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function docSVGPath(width, height) {
|
|
25
|
-
const
|
|
25
|
+
const waveHeight = height / 8;
|
|
26
|
+
const baseY = roundDpr(height - waveHeight / 2);
|
|
26
27
|
const amplitude = roundDpr(height / 6);
|
|
27
28
|
const radius = 6;
|
|
28
29
|
return { path: `
|
|
@@ -302,15 +303,13 @@ function ShapeSvgOutline({ shape, w, h }) {
|
|
|
302
303
|
children: /* @__PURE__ */ jsx("path", { d: cylinderSVGPath(w + 6, h + 6).path })
|
|
303
304
|
});
|
|
304
305
|
break;
|
|
305
|
-
default:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
});
|
|
313
|
-
break;
|
|
306
|
+
default: svg = /* @__PURE__ */ jsx("rect", {
|
|
307
|
+
x: -3,
|
|
308
|
+
y: -3,
|
|
309
|
+
width: w + 6,
|
|
310
|
+
height: h + 6,
|
|
311
|
+
rx: 8
|
|
312
|
+
});
|
|
314
313
|
}
|
|
315
314
|
return /* @__PURE__ */ jsx("g", {
|
|
316
315
|
className: "likec4-shape-outline",
|
|
@@ -3,11 +3,11 @@ import { BaseNodePropsWithData } from '../../base/types';
|
|
|
3
3
|
export type ElementTagProps = {
|
|
4
4
|
tag: string;
|
|
5
5
|
cursor?: 'pointer' | 'default';
|
|
6
|
-
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'color'>;
|
|
6
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'color' | 'translate'>;
|
|
7
7
|
export declare const ElementTag: ForwardRefExoticComponent<{
|
|
8
8
|
tag: string;
|
|
9
9
|
cursor?: "pointer" | "default";
|
|
10
|
-
} & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "children"> & RefAttributes<HTMLDivElement>>;
|
|
10
|
+
} & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "color" | "translate" | "children"> & RefAttributes<HTMLDivElement>>;
|
|
11
11
|
type Data = {
|
|
12
12
|
tags: readonly string[] | null | undefined;
|
|
13
13
|
width: number;
|
|
@@ -19,7 +19,7 @@ var ElementTag = forwardRef(({ tag, cursor, className, style, ...props }, ref) =
|
|
|
19
19
|
className: cx(likec4tag(), className),
|
|
20
20
|
...props,
|
|
21
21
|
style: {
|
|
22
|
-
cursor,
|
|
22
|
+
...cursor && { cursor },
|
|
23
23
|
...style
|
|
24
24
|
},
|
|
25
25
|
children: [/* @__PURE__ */ jsx("span", { children: "#" }), /* @__PURE__ */ jsx("span", { children: tag })]
|
|
@@ -85,12 +85,12 @@ function WithElementTags({ id, tags, width, hovered, onTagClick, onTagMouseEnter
|
|
|
85
85
|
display: "flex",
|
|
86
86
|
alignItems: "center",
|
|
87
87
|
justifyContent: "center",
|
|
88
|
-
maxWidth: "50px",
|
|
89
|
-
height: "5px",
|
|
88
|
+
maxWidth: "[50px]",
|
|
89
|
+
height: "[5px]",
|
|
90
90
|
_whenHovered: {
|
|
91
|
-
height: "12px",
|
|
91
|
+
height: "[12px]",
|
|
92
92
|
borderRadius: "sm",
|
|
93
|
-
transitionDelay: "
|
|
93
|
+
transitionDelay: "fastest"
|
|
94
94
|
},
|
|
95
95
|
transition: "fast"
|
|
96
96
|
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { isCssProperty, styled } from "@likec4/styles/jsx";
|
|
3
|
+
import { emptyBox } from "@likec4/styles/recipes";
|
|
4
|
+
//#region src/components/EmptyBox.tsx
|
|
5
|
+
var EmptyBox = styled("div", emptyBox, { shouldForwardProp(prop, variantKeys) {
|
|
6
|
+
return !variantKeys.includes(prop) && !isCssProperty(prop);
|
|
7
|
+
} });
|
|
8
|
+
//#endregion
|
|
9
|
+
export { EmptyBox };
|
|
@@ -17,20 +17,21 @@ function ErrorFallback({ error, resetErrorBoundary }) {
|
|
|
17
17
|
margin: "0",
|
|
18
18
|
padding: "0",
|
|
19
19
|
position: "fixed",
|
|
20
|
-
top: "
|
|
21
|
-
left: "
|
|
22
|
-
width: "[calc(100vw - ({spacing.
|
|
20
|
+
top: "5",
|
|
21
|
+
left: "5",
|
|
22
|
+
width: "[calc(100vw - ({spacing.5} * 2))]",
|
|
23
23
|
height: "max-content",
|
|
24
|
-
maxHeight: "[calc(100vh - ({spacing.
|
|
24
|
+
maxHeight: "[calc(100vh - ({spacing.5} * 3))]",
|
|
25
25
|
background: `likec4.overlay.body`,
|
|
26
26
|
rounded: "sm",
|
|
27
|
-
borderWidth:
|
|
27
|
+
borderWidth: "extra",
|
|
28
28
|
borderColor: `likec4.overlay.border`,
|
|
29
29
|
shadow: "xl",
|
|
30
30
|
outline: "none",
|
|
31
|
+
zIndex: "toast",
|
|
31
32
|
_backdrop: {
|
|
32
33
|
cursor: "zoom-out",
|
|
33
|
-
backdropFilter: `blur(18px)`,
|
|
34
|
+
backdropFilter: `[blur(18px)]`,
|
|
34
35
|
bg: "[color-mix(in oklab, {colors.likec4.overlay.backdrop} 60%, transparent)]"
|
|
35
36
|
}
|
|
36
37
|
}),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FloatingWindowProps as MantineFloatingWindowProps } from '@mantine/core';
|
|
2
|
+
export interface FloatingWindowProps extends MantineFloatingWindowProps {
|
|
3
|
+
/**
|
|
4
|
+
* To make window position and size persistent, provide a stable id
|
|
5
|
+
*/
|
|
6
|
+
windowId?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* If true, the window will not be resizable
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
nonResizeable?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Callback when the window is closed
|
|
14
|
+
* If provided, the window will render a close button
|
|
15
|
+
*/
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function FloatingWindow({ children, windowId, onClose, dimensions, initialPosition, className, nonResizeable, ...props }: FloatingWindowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { __name } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
|
+
import { useMantinePortalProps } from "../hooks/useMantinePortalProps.js";
|
|
4
|
+
import { cx } from "@likec4/styles/css";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useRafCallback } from "@react-hookz/web";
|
|
8
|
+
import { CloseButton, FloatingWindow } from "@mantine/core";
|
|
9
|
+
import { useSessionStorage } from "@mantine/hooks";
|
|
10
|
+
import { Box as Box$1 } from "@likec4/styles/jsx";
|
|
11
|
+
import { floatingWindow } from "@likec4/styles/recipes";
|
|
12
|
+
//#region src/components/FloatingWindow.tsx
|
|
13
|
+
function FloatingWindow$1({ children, windowId, onClose, dimensions, initialPosition, className, nonResizeable = false, ...props }) {
|
|
14
|
+
const portalProps = useMantinePortalProps();
|
|
15
|
+
const id = useId$1();
|
|
16
|
+
const [windowState, setWindowState] = useSessionStorage({
|
|
17
|
+
key: `likec4:window:${windowId ?? id}`,
|
|
18
|
+
getInitialValueInEffect: false,
|
|
19
|
+
defaultValue: {
|
|
20
|
+
dimensions: {
|
|
21
|
+
minWidth: 220,
|
|
22
|
+
minHeight: 250,
|
|
23
|
+
initialWidth: 260,
|
|
24
|
+
initialHeight: 360,
|
|
25
|
+
...dimensions
|
|
26
|
+
},
|
|
27
|
+
initialPosition: {
|
|
28
|
+
top: 65,
|
|
29
|
+
left: 32,
|
|
30
|
+
...initialPosition
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const initialStateRef = useRef(windowState);
|
|
35
|
+
const [updateWindowState] = useRafCallback((update) => {
|
|
36
|
+
setWindowState((state) => ({
|
|
37
|
+
dimensions: {
|
|
38
|
+
...state.dimensions,
|
|
39
|
+
...update.dimensions
|
|
40
|
+
},
|
|
41
|
+
initialPosition: {
|
|
42
|
+
...state.initialPosition,
|
|
43
|
+
...update.initialPosition
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
return /* @__PURE__ */ jsxs(FloatingWindow, {
|
|
48
|
+
constrainToViewport: true,
|
|
49
|
+
constrainOffset: 4,
|
|
50
|
+
dragHandleSelector: ".drag-handle",
|
|
51
|
+
excludeDragHandleSelector: "button, .nodrag, .mantine-ScrollArea-root",
|
|
52
|
+
className: cx(floatingWindow(), className),
|
|
53
|
+
...portalProps,
|
|
54
|
+
...props,
|
|
55
|
+
...initialStateRef.current,
|
|
56
|
+
onPositionChange: (position) => {
|
|
57
|
+
updateWindowState({ initialPosition: {
|
|
58
|
+
top: position.y,
|
|
59
|
+
left: position.x
|
|
60
|
+
} });
|
|
61
|
+
props.onPositionChange?.(position);
|
|
62
|
+
},
|
|
63
|
+
onSizeChange: (size) => {
|
|
64
|
+
updateWindowState({ dimensions: {
|
|
65
|
+
initialHeight: size.height,
|
|
66
|
+
initialWidth: size.width
|
|
67
|
+
} });
|
|
68
|
+
props.onSizeChange?.(size);
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
children,
|
|
72
|
+
!nonResizeable && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FloatingWindow.ResizeHandle, {
|
|
73
|
+
"data-resize-handler": "right",
|
|
74
|
+
tabIndex: -1
|
|
75
|
+
}), /* @__PURE__ */ jsx(FloatingWindow.ResizeHandle, { "data-resize-handler": "bottom" })] }),
|
|
76
|
+
/* @__PURE__ */ jsx(Box$1, {
|
|
77
|
+
className: "drag-header drag-handle",
|
|
78
|
+
pr: "1",
|
|
79
|
+
children: onClose && /* @__PURE__ */ jsx(CloseButton, {
|
|
80
|
+
size: 16,
|
|
81
|
+
onClick: onClose
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
__name(FloatingWindow$1, "FloatingWindow");
|
|
88
|
+
//#endregion
|
|
89
|
+
export { FloatingWindow$1 as FloatingWindow };
|
package/dist/components/Link.js
CHANGED
|
@@ -23,9 +23,9 @@ var Link = forwardRef(({ value, className, ...props }, ref) => {
|
|
|
23
23
|
timeout: 1500,
|
|
24
24
|
children: ({ copy, copied }) => /* @__PURE__ */ jsx(ActionIcon, {
|
|
25
25
|
className: css({
|
|
26
|
-
opacity: copied ? 1 : .45,
|
|
26
|
+
opacity: copied ? "1" : "0.45",
|
|
27
27
|
transition: "fast",
|
|
28
|
-
_hover: { opacity: 1 }
|
|
28
|
+
_hover: { opacity: "1" }
|
|
29
29
|
}),
|
|
30
30
|
tabIndex: -1,
|
|
31
31
|
size: "20",
|
|
@@ -45,8 +45,8 @@ var Link = forwardRef(({ value, className, ...props }, ref) => {
|
|
|
45
45
|
classNames: {
|
|
46
46
|
root: css({
|
|
47
47
|
flexWrap: "nowrap",
|
|
48
|
-
minHeight:
|
|
49
|
-
maxWidth:
|
|
48
|
+
minHeight: "[24px]",
|
|
49
|
+
maxWidth: "[500px]",
|
|
50
50
|
userSelect: "all",
|
|
51
51
|
pr: "0",
|
|
52
52
|
backgroundColor: {
|
|
@@ -63,7 +63,7 @@ var Link = forwardRef(({ value, className, ...props }, ref) => {
|
|
|
63
63
|
pointerEvents: "none",
|
|
64
64
|
_groupHover: {
|
|
65
65
|
color: "[var(--badge-color)]",
|
|
66
|
-
opacity: .7
|
|
66
|
+
opacity: "0.7"
|
|
67
67
|
}
|
|
68
68
|
} })
|
|
69
69
|
},
|
|
@@ -77,8 +77,8 @@ var Link = forwardRef(({ value, className, ...props }, ref) => {
|
|
|
77
77
|
css: {
|
|
78
78
|
transition: "fast",
|
|
79
79
|
opacity: {
|
|
80
|
-
base: .7,
|
|
81
|
-
_hover: 1
|
|
80
|
+
base: "0.7",
|
|
81
|
+
_hover: "1"
|
|
82
82
|
},
|
|
83
83
|
textDecoration: {
|
|
84
84
|
base: "none",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ForwardRefComponent, HTMLMotionProps } from 'motion/react';
|
|
2
2
|
import { HTMLAttributes, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
-
import { StyleContextProvider, StyleContextConsumer } from '
|
|
4
|
-
import { NavigationPanelRecipe } from '
|
|
3
|
+
import { StyleContextProvider, StyleContextConsumer } from '@likec4/styles/jsx';
|
|
4
|
+
import { NavigationPanelRecipe } from '@likec4/styles/recipes';
|
|
5
5
|
export declare const NavigationPanel: {
|
|
6
6
|
Root: StyleContextProvider<ForwardRefComponent<"div", HTMLMotionProps<"div">>, NavigationPanelRecipe>;
|
|
7
7
|
Body: StyleContextConsumer<ForwardRefComponent<"div", HTMLMotionProps<"div">>>;
|
|
@@ -3,9 +3,8 @@ import { Logo as Logo$1, LogoIcon } from "./Logo.js";
|
|
|
3
3
|
import { cx } from "@likec4/styles/css";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { isValidMotionProp } from "motion/react";
|
|
6
|
+
import { isValidMotionProp, m } from "motion/react";
|
|
7
7
|
import { createStyleContext, isCssProperty } from "@likec4/styles/jsx";
|
|
8
|
-
import * as m$1 from "motion/react-m";
|
|
9
8
|
import { navigationPanel } from "@likec4/styles/recipes";
|
|
10
9
|
//#region src/components/NavigationPanel.tsx
|
|
11
10
|
var { withProvider, withContext } = createStyleContext(navigationPanel);
|
|
@@ -19,11 +18,11 @@ var LogoButton = forwardRef(({ className, ...props }, ref) => {
|
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
var NavigationPanel = {
|
|
22
|
-
Root: withProvider(m
|
|
23
|
-
Body: withContext(m
|
|
21
|
+
Root: withProvider(m.div, "root", { shouldForwardProp }),
|
|
22
|
+
Body: withContext(m.div, "body", { shouldForwardProp }),
|
|
24
23
|
Logo: withContext(LogoButton, "logo", { shouldForwardProp }),
|
|
25
|
-
Label: withContext(m
|
|
26
|
-
Dropdown: withContext(m
|
|
24
|
+
Label: withContext(m.div, "label", { shouldForwardProp }),
|
|
25
|
+
Dropdown: withContext(m.div, "dropdown", { shouldForwardProp })
|
|
27
26
|
};
|
|
28
27
|
//#endregion
|
|
29
28
|
export { NavigationPanel };
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { css } from "@likec4/styles/css";
|
|
2
2
|
//#region src/components/SearchControl.css.ts
|
|
3
3
|
var root = css({
|
|
4
|
-
height: "
|
|
4
|
+
height: "control.sm",
|
|
5
5
|
paddingLeft: "sm",
|
|
6
6
|
paddingRight: "1",
|
|
7
7
|
borderRadius: "sm",
|
|
8
|
-
border: "
|
|
8
|
+
border: "default",
|
|
9
9
|
borderColor: {
|
|
10
|
-
base: "default
|
|
10
|
+
base: "border.default",
|
|
11
11
|
_light: "mantine.gray[4]",
|
|
12
12
|
_dark: "mantine.dark[4]",
|
|
13
|
-
_hover: "default
|
|
13
|
+
_hover: "border.default"
|
|
14
14
|
},
|
|
15
15
|
cursor: "pointer",
|
|
16
16
|
background: {
|
|
17
|
-
base: "default",
|
|
18
|
-
|
|
19
|
-
_dark: "mantine.dark[6]",
|
|
20
|
-
_hover: "default.hover"
|
|
17
|
+
base: "surface.default",
|
|
18
|
+
_hover: "surface.hover"
|
|
21
19
|
},
|
|
22
20
|
width: "100%",
|
|
23
21
|
"& .tabler-icon": { color: "text" },
|
|
@@ -35,18 +33,18 @@ var placeholder = css({
|
|
|
35
33
|
fontSize: "sm",
|
|
36
34
|
fontWeight: "medium",
|
|
37
35
|
paddingRight: "2.5",
|
|
38
|
-
color: "text.
|
|
36
|
+
color: "text.non-essential",
|
|
39
37
|
flex: "1",
|
|
40
38
|
sm: { paddingRight: "[30px]" },
|
|
41
39
|
md: { paddingRight: "[50px]" }
|
|
42
40
|
});
|
|
43
41
|
var shortcut = css({
|
|
44
|
-
fontSize: "
|
|
42
|
+
fontSize: "xxs",
|
|
45
43
|
fontWeight: "bold",
|
|
46
|
-
lineHeight:
|
|
44
|
+
lineHeight: "tight",
|
|
47
45
|
padding: "[4px 7px]",
|
|
48
46
|
borderRadius: "sm",
|
|
49
|
-
border: "
|
|
47
|
+
border: "default",
|
|
50
48
|
transition: "fast",
|
|
51
49
|
_light: {
|
|
52
50
|
color: "mantine.gray[7]",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconProps } from '@tabler/icons-react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the appropriate icon component for a given view type.
|
|
5
|
+
* @param viewType - The type of view ('index', 'element', 'deployment', or 'dynamic')
|
|
6
|
+
* @returns The corresponding icon component
|
|
7
|
+
*/
|
|
8
|
+
export declare function viewIcon(viewType: 'index' | 'element' | 'deployment' | 'dynamic'): JSX.Element;
|
|
9
|
+
export declare function ViewIcon({ type, className, ...props }: IconProps & {
|
|
10
|
+
type: 'index' | 'element' | 'deployment' | 'dynamic';
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { css, cx } from "@likec4/styles/css";
|
|
3
|
+
import { IconDirectionSignFilled, IconStack2, IconStarFilled, IconZoomScan } from "@tabler/icons-react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { nonexhaustive } from "@likec4/core";
|
|
6
|
+
//#region src/components/ViewIcon.tsx
|
|
7
|
+
var viewTypeIconCss = css({
|
|
8
|
+
verticalAlign: "middle",
|
|
9
|
+
opacity: {
|
|
10
|
+
base: "0.4",
|
|
11
|
+
_dark: "0.5",
|
|
12
|
+
_groupHover: "0.8",
|
|
13
|
+
_groupActive: "0.8",
|
|
14
|
+
_groupFocus: "0.8"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var viewIcons = {
|
|
18
|
+
index: /* @__PURE__ */ jsx(IconStarFilled, {
|
|
19
|
+
size: 16,
|
|
20
|
+
className: viewTypeIconCss
|
|
21
|
+
}),
|
|
22
|
+
element: /* @__PURE__ */ jsx(IconZoomScan, {
|
|
23
|
+
size: 18,
|
|
24
|
+
stroke: 2,
|
|
25
|
+
className: viewTypeIconCss
|
|
26
|
+
}),
|
|
27
|
+
deployment: /* @__PURE__ */ jsx(IconStack2, {
|
|
28
|
+
size: 16,
|
|
29
|
+
stroke: 1.5,
|
|
30
|
+
className: viewTypeIconCss
|
|
31
|
+
}),
|
|
32
|
+
dynamic: /* @__PURE__ */ jsx(IconDirectionSignFilled, {
|
|
33
|
+
size: 18,
|
|
34
|
+
className: viewTypeIconCss
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Returns the appropriate icon component for a given view type.
|
|
39
|
+
* @param viewType - The type of view ('index', 'element', 'deployment', or 'dynamic')
|
|
40
|
+
* @returns The corresponding icon component
|
|
41
|
+
*/
|
|
42
|
+
function viewIcon(viewType) {
|
|
43
|
+
return viewIcons[viewType];
|
|
44
|
+
}
|
|
45
|
+
function ViewIcon({ type, className, ...props }) {
|
|
46
|
+
if (type === "index") return /* @__PURE__ */ jsx(IconStarFilled, {
|
|
47
|
+
size: 16,
|
|
48
|
+
className: cx(viewTypeIconCss, className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
if (type === "element") return /* @__PURE__ */ jsx(IconZoomScan, {
|
|
52
|
+
size: 18,
|
|
53
|
+
stroke: 2,
|
|
54
|
+
className: cx(viewTypeIconCss, className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
if (type === "deployment") return /* @__PURE__ */ jsx(IconStack2, {
|
|
58
|
+
size: 16,
|
|
59
|
+
stroke: 1.5,
|
|
60
|
+
className: cx(viewTypeIconCss, className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
if (type === "dynamic") return /* @__PURE__ */ jsx(IconDirectionSignFilled, {
|
|
64
|
+
size: 18,
|
|
65
|
+
className: cx(viewTypeIconCss, className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
nonexhaustive(type);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { ViewIcon, viewIcon };
|
|
@@ -5,8 +5,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/context/CurrentViewModelProvider.tsx
|
|
6
6
|
function CurrentViewModelProvider({ children }) {
|
|
7
7
|
const viewId = useCurrentViewId();
|
|
8
|
+
const viewmodel = useOptionalLikeC4Model()?.findView(viewId) ?? null;
|
|
8
9
|
return /* @__PURE__ */ jsx(CurrentViewModelContext, {
|
|
9
|
-
value:
|
|
10
|
+
value: viewmodel,
|
|
10
11
|
children
|
|
11
12
|
});
|
|
12
13
|
}
|
|
@@ -16,7 +16,8 @@ var defaultHandlers = {
|
|
|
16
16
|
onLogoClick: null,
|
|
17
17
|
onOpenSource: null,
|
|
18
18
|
onInitialized: null,
|
|
19
|
-
onLayoutTypeChange: null
|
|
19
|
+
onLayoutTypeChange: null,
|
|
20
|
+
onRelationshipBrowserScopeChange: null
|
|
20
21
|
};
|
|
21
22
|
var HandlerNames = keys(defaultHandlers);
|
|
22
23
|
var DiagramEventHandlersRefContext = createContext({ current: defaultHandlers });
|
|
@@ -26,13 +27,14 @@ var DiagramEventHandlersReactContext = createContext({
|
|
|
26
27
|
});
|
|
27
28
|
function DiagramEventHandlers({ handlers, children }) {
|
|
28
29
|
const handlersRef = useSyncedRef(handlers);
|
|
30
|
+
const deps = HandlerNames.map((name) => isFunction(handlers[name]));
|
|
29
31
|
const value = useMemo(() => ({
|
|
30
32
|
...mapToObj(HandlerNames, (name) => {
|
|
31
33
|
if (handlersRef.current[name]) return [name, (...args) => handlersRef.current[name]?.(...args)];
|
|
32
34
|
return [name, null];
|
|
33
35
|
}),
|
|
34
36
|
handlersRef
|
|
35
|
-
}), [handlersRef, ...
|
|
37
|
+
}), [handlersRef, ...deps]);
|
|
36
38
|
return /* @__PURE__ */ jsx(DiagramEventHandlersRefContext.Provider, {
|
|
37
39
|
value: handlersRef,
|
|
38
40
|
children: /* @__PURE__ */ jsx(DiagramEventHandlersReactContext.Provider, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { LikeC4MantineProvider } from "../LikeC4MantineProvider.js";
|
|
3
3
|
import { useContext, useEffect } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
5
5
|
import { MantineContext } from "@mantine/core";
|
|
@@ -7,9 +7,9 @@ import { MantineContext } from "@mantine/core";
|
|
|
7
7
|
function EnsureMantine({ children }) {
|
|
8
8
|
const mantineCtx = useContext(MantineContext);
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
if (!mantineCtx) console.warn("LikeC4Diagram must be a child of
|
|
10
|
+
if (!mantineCtx) console.warn("LikeC4Diagram must be a child of LikeC4MantineProvider");
|
|
11
11
|
}, []);
|
|
12
|
-
if (!mantineCtx) return /* @__PURE__ */ jsx(
|
|
12
|
+
if (!mantineCtx) return /* @__PURE__ */ jsx(LikeC4MantineProvider, { children });
|
|
13
13
|
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementShape } from '@likec4/core';
|
|
2
2
|
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import { ElementIconRenderer } from '../LikeC4Diagram.props';
|
|
3
|
+
import { ElementIconRenderer, ElementIconRendererProps } from '../LikeC4Diagram.props';
|
|
4
4
|
/**
|
|
5
5
|
* Provider for custom element icon renderers
|
|
6
6
|
*
|
|
@@ -37,3 +37,4 @@ export declare function IconOrShapeRenderer({ element, className, style, }: {
|
|
|
37
37
|
className?: string;
|
|
38
38
|
style?: CSSProperties | undefined;
|
|
39
39
|
}): import("react").JSX.Element;
|
|
40
|
+
export declare function DefaultIconRenderer({ node, ...props }: ElementIconRendererProps): import("react").JSX.Element | null;
|