@likec4/diagram 1.38.0 → 1.39.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.
Files changed (86) hide show
  1. package/bundle/{chunk-BZV0K82k.js → chunk-Bg7UjtMS.js} +332 -326
  2. package/bundle/custom.js +59 -59
  3. package/bundle/index.js +244 -170
  4. package/dist/LikeC4Diagram.props.d.ts +15 -8
  5. package/dist/base/BaseXYFlow.js +5 -5
  6. package/dist/base/index.d.ts +1 -2
  7. package/dist/base/primitives/MarkdownBlock.js +2 -1
  8. package/dist/base/primitives/customEdge.d.ts +3 -3
  9. package/dist/base/primitives/element/ElementTitle.js +2 -10
  10. package/dist/base/types.d.ts +62 -5
  11. package/dist/base/types.js +54 -0
  12. package/dist/bundle/LikeC4View.d.ts +2 -2
  13. package/dist/bundle/LikeC4View.props.d.ts +4 -3
  14. package/dist/bundle/ReactLikeC4.d.ts +4 -4
  15. package/dist/custom/customNodes.d.ts +2 -1
  16. package/dist/hooks/useXYFlow.d.ts +28 -29
  17. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +4 -5
  18. package/dist/likec4diagram/custom/nodes/ElementActions.js +1 -1
  19. package/dist/likec4diagram/types.d.ts +2 -1
  20. package/dist/likec4diagram/useViewToNodesEdges.js +1 -1
  21. package/dist/likec4model/LikeC4ModelContext.d.ts +5 -2
  22. package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
  23. package/dist/likec4model/useLikeC4Model.d.ts +7 -20
  24. package/dist/navigationpanel/NavigationPanel.js +3 -1
  25. package/dist/navigationpanel/NavigationPanelDropdown.js +1 -1
  26. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +6 -4
  27. package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -0
  28. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +83 -0
  29. package/dist/overlays/element-details/actor.d.ts +556 -557
  30. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +2 -3
  31. package/dist/overlays/relationship-details/actor.d.ts +1 -1
  32. package/dist/overlays/relationship-details/actor.js +7 -7
  33. package/dist/overlays/relationship-details/compute.js +2 -1
  34. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +2 -3
  35. package/dist/overlays/relationship-details/hooks.d.ts +18 -19
  36. package/dist/overlays/relationship-details/layout.js +2 -1
  37. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +2 -3
  38. package/dist/overlays/relationships-browser/actor.d.ts +12 -12
  39. package/dist/overlays/relationships-browser/actor.js +8 -8
  40. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +2 -3
  41. package/dist/overlays/relationships-browser/layout.js +2 -1
  42. package/dist/search/components/ElementsColumn.js +1 -1
  43. package/dist/state/DiagramActorProvider.js +2 -2
  44. package/dist/state/assign.js +6 -6
  45. package/dist/state/diagram-machine.js +14 -14
  46. package/dist/styles-min.css +1 -1
  47. package/dist/styles-xyflow.css +1 -1
  48. package/dist/styles.css +1 -1
  49. package/dist/styles.css2.js +1 -1
  50. package/dist/utils/xyflow.js +2 -2
  51. package/package.json +16 -16
  52. package/panda.buildinfo.json +14 -11
  53. package/src/LikeC4Diagram.props.ts +16 -16
  54. package/src/base/index.ts +1 -2
  55. package/src/base/primitives/MarkdownBlock.tsx +1 -0
  56. package/src/base/primitives/customEdge.ts +5 -5
  57. package/src/base/primitives/element/ElementTitle.tsx +10 -22
  58. package/src/base/types.ts +122 -13
  59. package/src/bundle/LikeC4View.props.ts +4 -3
  60. package/src/bundle/LikeC4View.tsx +6 -6
  61. package/src/bundle/ReactLikeC4.tsx +7 -6
  62. package/src/custom/customNodes.ts +3 -1
  63. package/src/hooks/useSetState.ts +2 -2
  64. package/src/likec4diagram/custom/nodes/ElementActions.tsx +2 -1
  65. package/src/likec4diagram/types.ts +1 -1
  66. package/src/likec4diagram/useViewToNodesEdges.ts +1 -1
  67. package/src/likec4model/LikeC4ModelContext.tsx +5 -2
  68. package/src/likec4model/useLikeC4ElementsTree.ts +3 -3
  69. package/src/likec4model/useLikeC4Model.ts +8 -5
  70. package/src/navigationpanel/NavigationPanel.tsx +2 -0
  71. package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -1
  72. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +3 -1
  73. package/src/navigationpanel/walkthrough/WalkthroughPanel.tsx +88 -0
  74. package/src/overlays/relationship-details/compute.ts +3 -12
  75. package/src/overlays/relationship-details/layout.ts +3 -3
  76. package/src/overlays/relationships-browser/actor.ts +2 -1
  77. package/src/overlays/relationships-browser/layout.ts +3 -3
  78. package/src/search/components/ElementsColumn.tsx +3 -3
  79. package/src/utils/xyflow.ts +2 -2
  80. package/dist/base/types.Base.d.ts +0 -54
  81. package/dist/base/types.Base.js +0 -48
  82. package/dist/likec4diagram/custom/edges/NotePopover.d.ts +0 -4
  83. package/src/base/types.Base.ts +0 -104
  84. package/src/likec4diagram/custom/edges/NotePopover.tsx +0 -95
  85. /package/dist/{likec4diagram/custom/edges/NotePopover.css.d.ts → navigationpanel/walkthrough/WalkthroughPanel.css.d.ts} +0 -0
  86. /package/src/{likec4diagram/custom/edges/NotePopover.css.ts → navigationpanel/walkthrough/WalkthroughPanel.css.ts} +0 -0
@@ -1,20 +1,7 @@
1
- import { aux, LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
2
- import { TagSpecification, ElementSpecification, RelationshipSpecification, CustomColorDefinitions } from '@likec4/core';
3
- export declare function useLikeC4Model<A extends aux.Any = aux.UnknownLayouted>(): LikeC4Model<A>;
4
- export declare function useLikeC4ViewModel<A extends aux.Any = aux.UnknownLayouted>(viewId: aux.ViewId<A>): LikeC4ViewModel<A>;
5
- export declare function useLikeC4Specification(): {
6
- tags: {
7
- [x: string]: TagSpecification;
8
- };
9
- elements: {
10
- [x: string]: Partial< ElementSpecification>;
11
- };
12
- deployments: {
13
- [x: string]: Partial< ElementSpecification>;
14
- };
15
- relationships: {
16
- [x: string]: Partial< RelationshipSpecification>;
17
- };
18
- metadataKeys?: string[];
19
- customColors?: CustomColorDefinitions;
20
- };
1
+ import { LikeC4Model, LikeC4ViewModel } from '@likec4/core/model';
2
+ import type * as t from '@likec4/core/types';
3
+ type Any = t.aux.Any;
4
+ export declare function useLikeC4Model<A extends Any = t.aux.UnknownLayouted>(): LikeC4Model<A>;
5
+ export declare function useLikeC4ViewModel<A extends Any = t.aux.UnknownLayouted>(viewId: t.aux.ViewId<A>): LikeC4ViewModel<A>;
6
+ export declare function useLikeC4Specification(): t.Specification<t.aux.UnknownLayouted>;
7
+ export {};
@@ -15,6 +15,7 @@ import { navigationPanelActorLogic } from './actor.js';
15
15
  import { NavigationPanelActorContextProvider } from './hooks.js';
16
16
  import { NavigationPanelControls } from './NavigationPanelControls.js';
17
17
  import { NavigationPanelDropdown } from './NavigationPanelDropdown.js';
18
+ import { WalkthroughPanel } from './walkthrough/WalkthroughPanel.js';
18
19
  import { EditorPanel } from './editorpanel/EditorPanel.js';
19
20
  import { ActiveWalkthroughControls } from './walkthrough/ActiveWalkthroughControls.js';
20
21
 
@@ -69,7 +70,8 @@ const NavigationPanel = memo(() => {
69
70
  },
70
71
  children: /* @__PURE__ */ jsxs(NavigationPanelActorContextProvider, { value: actorRef, children: [
71
72
  /* @__PURE__ */ jsx(NavigationPanelImpl, { actor: actorRef }),
72
- /* @__PURE__ */ jsx(EditorPanel, {})
73
+ /* @__PURE__ */ jsx(EditorPanel, {}),
74
+ /* @__PURE__ */ jsx(WalkthroughPanel, {})
73
75
  ] })
74
76
  }
75
77
  ) });
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { ifilter, ifirst, toArray, compareNaturalHierarchically, nonexhaustive } from '@likec4/core';
3
2
  import { normalizeViewPath, VIEW_FOLDERS_SEPARATOR } from '@likec4/core/model';
3
+ import { ifilter, ifirst, toArray, compareNaturalHierarchically, nonexhaustive } from '@likec4/core/utils';
4
4
  import { cx, css } from '@likec4/styles/css';
5
5
  import { HStack, VStack, Box } from '@likec4/styles/jsx';
6
6
  import { vstack, hstack } from '@likec4/styles/patterns';
@@ -1,4 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { RichText } from '@likec4/core';
2
3
  import { css } from '@likec4/styles/css';
3
4
  import { Box } from '@likec4/styles/jsx';
4
5
  import { Button, Badge, Portal } from '@mantine/core';
@@ -79,7 +80,8 @@ const ActiveWalkthroughControls = () => {
79
80
  hasNext,
80
81
  hasPrevious,
81
82
  currentStep,
82
- totalSteps
83
+ totalSteps,
84
+ notes
83
85
  } = useDiagramContext((s) => {
84
86
  const currentStepIndex = s.xyedges.findIndex((e) => e.id === s.activeWalkthrough?.stepId);
85
87
  return {
@@ -87,7 +89,8 @@ const ActiveWalkthroughControls = () => {
87
89
  hasNext: currentStepIndex < s.xyedges.length - 1,
88
90
  hasPrevious: currentStepIndex > 0,
89
91
  currentStep: currentStepIndex + 1,
90
- totalSteps: s.xyedges.length
92
+ totalSteps: s.xyedges.length,
93
+ notes: s.xyedges[currentStepIndex]?.data?.notes ?? RichText.EMPTY
91
94
  };
92
95
  });
93
96
  return /* @__PURE__ */ jsxs(AnimatePresence, { propagate: true, children: [
@@ -103,8 +106,7 @@ const ActiveWalkthroughControls = () => {
103
106
  },
104
107
  rightSection: /* @__PURE__ */ jsx(IconPlayerStopFilled, { size: 10 }),
105
108
  children: "Stop"
106
- },
107
- "trigger-dynamic-walkthrough"
109
+ }
108
110
  ),
109
111
  /* @__PURE__ */ jsx(
110
112
  PrevNextButton,
@@ -0,0 +1 @@
1
+ export declare const WalkthroughPanel: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,83 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { RichText } from '@likec4/core';
3
+ import { cx, css } from '@likec4/styles/css';
4
+ import { styled } from '@likec4/styles/jsx';
5
+ import { vstack } from '@likec4/styles/patterns';
6
+ import { ScrollAreaAutosize } from '@mantine/core';
7
+ import { isNonNull, isTruthy } from 'remeda';
8
+ import { useDiagramContext } from '../../hooks/useDiagram.js';
9
+ import { MarkdownBlock } from '../../base/primitives/MarkdownBlock.js';
10
+
11
+ const SectionHeader = styled("div", {
12
+ base: {
13
+ fontSize: "xs",
14
+ color: "mantine.colors.dimmed",
15
+ fontWeight: 500,
16
+ userSelect: "none",
17
+ mb: "xxs"
18
+ }
19
+ });
20
+ function selectWalkthroughNotes(s) {
21
+ const isActive = isNonNull(s.activeWalkthrough);
22
+ const activeStepIndex = isActive ? s.xyedges.findIndex((e) => e.id === s.activeWalkthrough?.stepId) : -1;
23
+ return {
24
+ isActive,
25
+ isParallel: isActive && isTruthy(s.activeWalkthrough?.parallelPrefix),
26
+ hasNext: isActive && activeStepIndex < s.xyedges.length - 1,
27
+ hasPrevious: isActive && activeStepIndex > 0,
28
+ notes: isActive ? s.xyedges[activeStepIndex]?.data?.notes ?? RichText.EMPTY : null
29
+ };
30
+ }
31
+ const WalkthroughPanel = () => {
32
+ const { notes } = useDiagramContext(selectWalkthroughNotes);
33
+ if (!notes || notes.isEmpty) {
34
+ return null;
35
+ }
36
+ return /* @__PURE__ */ jsx(styled.div, { position: "relative", children: /* @__PURE__ */ jsxs(
37
+ ScrollAreaAutosize,
38
+ {
39
+ className: cx(
40
+ "nowheel nopan nodrag",
41
+ vstack({
42
+ position: "absolute",
43
+ layerStyle: "likec4.dropdown",
44
+ gap: "sm",
45
+ padding: "md",
46
+ paddingTop: "xxs",
47
+ pointerEvents: "all",
48
+ maxWidth: "calc(100cqw - 32px)",
49
+ minWidth: "calc(100cqw - 50px)",
50
+ maxHeight: "calc(100cqh - 100px)",
51
+ width: "max-content",
52
+ cursor: "default",
53
+ overflow: "auto",
54
+ overscrollBehavior: "contain",
55
+ "@/sm": {
56
+ minWidth: 400,
57
+ maxWidth: 550
58
+ },
59
+ "@/lg": {
60
+ maxWidth: 700
61
+ }
62
+ })
63
+ ),
64
+ type: "scroll",
65
+ children: [
66
+ /* @__PURE__ */ jsx(SectionHeader, { children: "Notes" }),
67
+ /* @__PURE__ */ jsx(
68
+ MarkdownBlock,
69
+ {
70
+ value: notes,
71
+ fontSize: "sm",
72
+ emptyText: "No description",
73
+ className: css({
74
+ userSelect: "all"
75
+ })
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ ) });
81
+ };
82
+
83
+ export { WalkthroughPanel };