likec4 1.42.1 → 1.43.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.
@@ -1801,7 +1801,7 @@ const ZIndexes = {
1801
1801
  }, MinZoom = 0.05, MaxZoom = 3, FitViewPaddings = {
1802
1802
  default: "16px",
1803
1803
  withControls: {
1804
- top: "50px",
1804
+ top: "58px",
1805
1805
  left: "16px",
1806
1806
  right: "16px",
1807
1807
  bottom: "16px"
@@ -8044,7 +8044,252 @@ const useElementDetailsActorRef = () => {
8044
8044
  borderWidth: "4px",
8045
8045
  borderColor: "mantine.colors.dark[1]"
8046
8046
  }
8047
- }), treeNode$1 = css({
8047
+ });
8048
+ function MetadataProvider({ children }) {
8049
+ return /* @__PURE__ */ jsx(Fragment, { children });
8050
+ }
8051
+ function TruncatedValue({ value, isExpanded }) {
8052
+ const [isTruncated, setIsTruncated] = useState(!1), textRef = useRef(null);
8053
+ return useEffect(() => {
8054
+ textRef.current && setIsTruncated(textRef.current.scrollWidth > textRef.current.clientWidth);
8055
+ }, [value]), /* @__PURE__ */ jsx(
8056
+ Tooltip$6,
8057
+ {
8058
+ label: isTruncated && !isExpanded ? value : null,
8059
+ multiline: !0,
8060
+ w: 300,
8061
+ withinPortal: !0,
8062
+ children: /* @__PURE__ */ jsx(
8063
+ Text,
8064
+ {
8065
+ ref: textRef,
8066
+ component: "div",
8067
+ className: css({
8068
+ fontSize: "sm",
8069
+ padding: "xs",
8070
+ userSelect: "all",
8071
+ color: "mantine.colors.text",
8072
+ lineHeight: 1.4,
8073
+ whiteSpace: isExpanded ? "pre-wrap" : "nowrap",
8074
+ overflow: isExpanded ? "visible" : "hidden",
8075
+ textOverflow: isExpanded ? "unset" : "ellipsis",
8076
+ wordBreak: isExpanded ? "break-word" : "normal",
8077
+ minWidth: 0,
8078
+ width: "100%"
8079
+ }),
8080
+ children: value
8081
+ }
8082
+ )
8083
+ }
8084
+ );
8085
+ }
8086
+ function MultiValueDisplay({
8087
+ values,
8088
+ isExpanded,
8089
+ onToggle
8090
+ }) {
8091
+ return isExpanded ? /* @__PURE__ */ jsx(Stack, { gap: "xs", children: values.map((value, index2) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
8092
+ /* @__PURE__ */ jsx(
8093
+ Text,
8094
+ {
8095
+ className: css({
8096
+ fontSize: "xs",
8097
+ color: "mantine.colors.gray[5]",
8098
+ fontWeight: 500,
8099
+ flexShrink: 0,
8100
+ _dark: {
8101
+ color: "mantine.colors.dark[3]"
8102
+ }
8103
+ }),
8104
+ children: "•"
8105
+ }
8106
+ ),
8107
+ /* @__PURE__ */ jsx(
8108
+ Box$1,
8109
+ {
8110
+ className: css({
8111
+ minHeight: "32px",
8112
+ display: "flex",
8113
+ alignItems: "center",
8114
+ flex: 1
8115
+ }),
8116
+ children: /* @__PURE__ */ jsx(TruncatedValue, { value, isExpanded: !0 })
8117
+ }
8118
+ )
8119
+ ] }, index2)) }) : /* @__PURE__ */ jsx(
8120
+ Box$1,
8121
+ {
8122
+ className: css({
8123
+ minHeight: "32px",
8124
+ display: "flex",
8125
+ alignItems: "center",
8126
+ padding: "xs",
8127
+ gap: "xs",
8128
+ flexWrap: "wrap",
8129
+ minWidth: 0,
8130
+ // Allow shrinking
8131
+ overflow: "hidden"
8132
+ // Prevent overflow
8133
+ }),
8134
+ children: values.map((value, index2) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", style: { minWidth: 0 }, children: [
8135
+ /* @__PURE__ */ jsx(
8136
+ Text,
8137
+ {
8138
+ className: css({
8139
+ fontSize: "sm",
8140
+ padding: "[4px 8px]",
8141
+ backgroundColor: "mantine.colors.white",
8142
+ color: "mantine.colors.text",
8143
+ borderRadius: "sm",
8144
+ border: "1px solid",
8145
+ borderColor: "mantine.colors.gray[3]",
8146
+ whiteSpace: "nowrap",
8147
+ overflow: "hidden",
8148
+ textOverflow: "ellipsis",
8149
+ maxWidth: "min(200px, 100%)",
8150
+ minWidth: "60px",
8151
+ flex: "0 1 auto",
8152
+ userSelect: "all",
8153
+ _dark: {
8154
+ backgroundColor: "mantine.colors.dark[9]",
8155
+ color: "mantine.colors.text",
8156
+ borderColor: "mantine.colors.dark[4]"
8157
+ }
8158
+ }),
8159
+ title: value,
8160
+ children: value
8161
+ }
8162
+ ),
8163
+ index2 < values.length - 1 && /* @__PURE__ */ jsx(
8164
+ Text,
8165
+ {
8166
+ className: css({
8167
+ fontSize: "xs",
8168
+ color: "mantine.colors.gray[5]",
8169
+ fontWeight: 500,
8170
+ flexShrink: 0,
8171
+ _dark: {
8172
+ color: "mantine.colors.dark[3]"
8173
+ }
8174
+ }),
8175
+ children: "•"
8176
+ }
8177
+ )
8178
+ ] }, index2))
8179
+ }
8180
+ );
8181
+ }
8182
+ function MetadataValue({ label: label2, value }) {
8183
+ const elements = Array.isArray(value) ? value : typeof value == "string" && value.includes(`
8184
+ `) ? value.split(`
8185
+ `).map((s) => s.trim()).filter(Boolean) : [value], hasMultipleElements = elements.length > 1, [isExpanded, setIsExpanded] = useState(!1), handleToggle = () => {
8186
+ setIsExpanded(!isExpanded);
8187
+ };
8188
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8189
+ hasMultipleElements ? /* @__PURE__ */ jsx(
8190
+ UnstyledButton,
8191
+ {
8192
+ onClick: handleToggle,
8193
+ className: css({
8194
+ fontSize: "xs",
8195
+ color: "mantine.colors.dimmed",
8196
+ justifySelf: "end",
8197
+ textAlign: "right",
8198
+ userSelect: "none",
8199
+ display: "flex",
8200
+ alignItems: "center",
8201
+ justifyContent: "flex-end",
8202
+ gap: "xs",
8203
+ padding: "[4px 8px]",
8204
+ borderRadius: "sm",
8205
+ whiteSpace: "nowrap",
8206
+ transition: "all 150ms ease",
8207
+ _hover: {
8208
+ backgroundColor: "mantine.colors.gray[1]",
8209
+ color: "mantine.colors.primary[6]",
8210
+ _dark: {
8211
+ backgroundColor: "mantine.colors.dark[7]",
8212
+ color: "mantine.colors.primary[4]"
8213
+ }
8214
+ }
8215
+ }),
8216
+ children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
8217
+ /* @__PURE__ */ jsxs(Text, { component: "span", size: "xs", fw: 700, children: [
8218
+ label2,
8219
+ ":"
8220
+ ] }),
8221
+ /* @__PURE__ */ jsx(
8222
+ Text,
8223
+ {
8224
+ component: "span",
8225
+ className: css({
8226
+ fontSize: "xs",
8227
+ fontWeight: 500,
8228
+ color: "mantine.colors.gray[6]",
8229
+ backgroundColor: "mantine.colors.gray[1]",
8230
+ padding: "[1px 4px]",
8231
+ borderRadius: "xs",
8232
+ _dark: {
8233
+ color: "mantine.colors.dark[2]",
8234
+ backgroundColor: "mantine.colors.dark[6]"
8235
+ }
8236
+ }),
8237
+ children: elements.length
8238
+ }
8239
+ ),
8240
+ isExpanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: 12 }) : /* @__PURE__ */ jsx(IconChevronRight, { size: 12 })
8241
+ ] })
8242
+ }
8243
+ ) : /* @__PURE__ */ jsxs(
8244
+ Text,
8245
+ {
8246
+ component: "div",
8247
+ className: css({
8248
+ fontSize: "xs",
8249
+ color: "mantine.colors.dimmed",
8250
+ justifySelf: "end",
8251
+ textAlign: "right",
8252
+ userSelect: "none",
8253
+ whiteSpace: "nowrap",
8254
+ padding: "[4px 8px]",
8255
+ fontWeight: 700
8256
+ }),
8257
+ children: [
8258
+ label2,
8259
+ ":"
8260
+ ]
8261
+ }
8262
+ ),
8263
+ /* @__PURE__ */ jsx(
8264
+ Box$1,
8265
+ {
8266
+ className: css({
8267
+ justifySelf: "stretch",
8268
+ alignSelf: "start"
8269
+ }),
8270
+ children: hasMultipleElements ? /* @__PURE__ */ jsx(
8271
+ MultiValueDisplay,
8272
+ {
8273
+ values: elements,
8274
+ isExpanded,
8275
+ onToggle: handleToggle
8276
+ }
8277
+ ) : /* @__PURE__ */ jsx(
8278
+ Box$1,
8279
+ {
8280
+ className: css({
8281
+ minHeight: "32px",
8282
+ display: "flex",
8283
+ alignItems: "center"
8284
+ }),
8285
+ children: /* @__PURE__ */ jsx(TruncatedValue, { value: elements[0] || "", isExpanded })
8286
+ }
8287
+ )
8288
+ }
8289
+ )
8290
+ ] });
8291
+ }
8292
+ const treeNode$1 = css({
8048
8293
  "&[data-level='1']": {
8049
8294
  marginBottom: "sm"
8050
8295
  }
@@ -10002,7 +10247,7 @@ function ElementDetailsCard({
10002
10247
  )
10003
10248
  ] })
10004
10249
  ] }),
10005
- /* @__PURE__ */ jsxs(
10250
+ /* @__PURE__ */ jsx(MetadataProvider, { children: /* @__PURE__ */ jsxs(
10006
10251
  Tabs,
10007
10252
  {
10008
10253
  value: activeTab,
@@ -10082,7 +10327,7 @@ function ElementDetailsCard({
10082
10327
  /* @__PURE__ */ jsx(TabsPanel, { value: "Deployments", children: /* @__PURE__ */ jsx(ScrollArea, { scrollbars: "y", type: "auto", children: /* @__PURE__ */ jsx(TabPanelDeployments, { elementFqn: elementModel.id }) }) })
10083
10328
  ]
10084
10329
  }
10085
- ),
10330
+ ) }),
10086
10331
  /* @__PURE__ */ jsx(
10087
10332
  m.div,
10088
10333
  {
@@ -10136,97 +10381,24 @@ function ElementProperty({
10136
10381
  function ElementMetata({
10137
10382
  value: metadata
10138
10383
  }) {
10139
- return /* @__PURE__ */ jsxs(Fragment, { children: [
10140
- /* @__PURE__ */ jsx(PropertyLabel, { children: "metadata" }),
10384
+ const metadataEntries = t$c(metadata).sort(([a], [b]) => a.localeCompare(b));
10385
+ return /* @__PURE__ */ jsx(MetadataProvider, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
10386
+ /* @__PURE__ */ jsx(PropertyLabel, { style: { justifySelf: "end", textAlign: "right" }, children: "metadata" }),
10141
10387
  /* @__PURE__ */ jsx(
10142
10388
  Box$1,
10143
10389
  {
10144
10390
  className: css({
10145
- flex: 1,
10146
10391
  display: "grid",
10147
10392
  gridTemplateColumns: "min-content 1fr",
10148
- gridAutoRows: "min-content max-content",
10149
- gap: "[4px 4px]",
10393
+ gridAutoRows: "min-content",
10394
+ gap: "[12px 16px]",
10150
10395
  alignItems: "baseline",
10151
- justifyItems: "stretch",
10152
- paddingRight: "xxs"
10396
+ justifyItems: "stretch"
10153
10397
  }),
10154
- children: t$c(metadata).map(([key2, value]) => /* @__PURE__ */ jsxs(
10155
- "div",
10156
- {
10157
- style: {
10158
- display: "contents"
10159
- },
10160
- className: "group",
10161
- children: [
10162
- /* @__PURE__ */ jsxs(
10163
- "div",
10164
- {
10165
- className: css({
10166
- fontSize: "sm",
10167
- fontWeight: 500,
10168
- justifySelf: "end",
10169
- whiteSpace: "nowrap"
10170
- }),
10171
- children: [
10172
- key2,
10173
- ":"
10174
- ]
10175
- }
10176
- ),
10177
- /* @__PURE__ */ jsx(
10178
- "div",
10179
- {
10180
- className: css({}),
10181
- children: /* @__PURE__ */ jsx(
10182
- ScrollArea.Autosize,
10183
- {
10184
- type: "auto",
10185
- mah: 200,
10186
- classNames: {
10187
- root: css({
10188
- transitionProperty: "all",
10189
- transitionDuration: "fast",
10190
- transitionTimingFunction: "inOut",
10191
- rounded: "sm",
10192
- color: "mantine.colors.gray[8]",
10193
- _dark: {
10194
- color: "mantine.colors.dark[1]"
10195
- },
10196
- _groupHover: {
10197
- transitionTimingFunction: "out",
10198
- color: "mantine.colors.defaultColor",
10199
- background: "mantine.colors.defaultHover"
10200
- }
10201
- }),
10202
- viewport: css({
10203
- overscrollBehavior: "none"
10204
- })
10205
- },
10206
- children: /* @__PURE__ */ jsx(
10207
- "div",
10208
- {
10209
- className: css({
10210
- fontSize: "sm",
10211
- padding: "xxs",
10212
- whiteSpace: "pre",
10213
- fontFamily: "mono",
10214
- userSelect: "all"
10215
- }),
10216
- children: value
10217
- }
10218
- )
10219
- }
10220
- )
10221
- }
10222
- )
10223
- ]
10224
- },
10225
- key2
10226
- ))
10398
+ children: metadataEntries.map(([key2, value]) => /* @__PURE__ */ jsx(MetadataValue, { label: key2, value }, key2))
10227
10399
  }
10228
10400
  )
10229
- ] });
10401
+ ] }) });
10230
10402
  }
10231
10403
  function ElementDetails({
10232
10404
  actorRef,
@@ -12986,20 +13158,17 @@ const shapeBadge = css({
12986
13158
  );
12987
13159
  }, selector = (s) => ({
12988
13160
  id: s.view.id,
12989
- notations: s.view.notation?.nodes ?? [],
12990
- isVisible: !0
12991
- // isVisible: isNullish(s.focusedNodeId ?? s.activeWalkthrough),
13161
+ notations: s.view.notation?.nodes ?? []
12992
13162
  }), NotationPanel = memo$1(() => {
12993
13163
  const height = useXYStore((s) => s.height), {
12994
13164
  id,
12995
- notations,
12996
- isVisible
13165
+ notations
12997
13166
  } = useDiagramContext(selector), [isCollapsed, setCollapsed] = useLocalStorage({
12998
13167
  key: "notation-webview-collapsed",
12999
13168
  defaultValue: !0
13000
13169
  }), hasNotations = notations.length > 0, portalProps = useMantinePortalProps();
13001
13170
  return /* @__PURE__ */ jsxs(AnimatePresence, { children: [
13002
- !hasNotations && isVisible && /* @__PURE__ */ jsx(
13171
+ !hasNotations && /* @__PURE__ */ jsx(
13003
13172
  m.div,
13004
13173
  {
13005
13174
  initial: { opacity: 0.75, translateX: "50%" },
@@ -13022,7 +13191,7 @@ const shapeBadge = css({
13022
13191
  },
13023
13192
  "empty"
13024
13193
  ),
13025
- hasNotations && isVisible && isCollapsed && /* @__PURE__ */ jsx(
13194
+ hasNotations && isCollapsed && /* @__PURE__ */ jsx(
13026
13195
  m.div,
13027
13196
  {
13028
13197
  initial: { opacity: 0.75, translateX: "50%" },
@@ -13046,7 +13215,7 @@ const shapeBadge = css({
13046
13215
  },
13047
13216
  "collapsed"
13048
13217
  ),
13049
- hasNotations && isVisible && !isCollapsed && /* @__PURE__ */ jsx(
13218
+ hasNotations && !isCollapsed && /* @__PURE__ */ jsx(
13050
13219
  m.div,
13051
13220
  {
13052
13221
  initial: {
@@ -14191,11 +14360,11 @@ function _update(current, updated) {
14191
14360
  function updateNodes(current, update) {
14192
14361
  return e$c(update) ? _update(current, update) : (update = current, (current2) => _update(current2, update));
14193
14362
  }
14194
- const ViewPadding = {
14363
+ const ViewPadding$1 = {
14195
14364
  top: "40px",
14196
- bottom: "16px",
14197
- left: "16px",
14198
- right: "16px"
14365
+ bottom: "22px",
14366
+ left: "22px",
14367
+ right: "22px"
14199
14368
  };
14200
14369
  function viewToNodesEdge(view) {
14201
14370
  const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map(), queue = Queue.from(view.nodes.reduce(
@@ -14354,7 +14523,7 @@ const findRootSubject = (nodes) => nodes.find(
14354
14523
  };
14355
14524
  }, parent = nonNullable(self._parent);
14356
14525
  let zoom = xyflow2.getZoom();
14357
- const maxZoom = Math.max(zoom, 1), nextviewport = getViewportForBounds(update.bounds, width, height, MinZoom, maxZoom, ViewPadding), nextSubjectNode = next.xynodes.find(
14526
+ const maxZoom = Math.max(zoom, 1), nextviewport = getViewportForBounds(update.bounds, width, height, MinZoom, maxZoom, ViewPadding$1), nextSubjectNode = next.xynodes.find(
14358
14527
  (n2) => n2.type !== "empty" && n2.data.column === "subjects" && n2.data.fqn === subjectId
14359
14528
  ) ?? findRootSubject(next.xynodes), currentSubjectNode = findRootSubject(currentNodes), existingNode = navigateFromNode ? currentNodes.find((n2) => n2.id === navigateFromNode) : currentNodes.find((n2) => n2.type !== "empty" && n2.data.column !== "subjects" && n2.data.fqn === subjectId);
14360
14529
  if (!nextSubjectNode || !existingNode || nextSubjectNode.type === "empty" || !currentSubjectNode || nextSubjectNode.data.fqn === currentSubjectNode.data.fqn)
@@ -14441,13 +14610,13 @@ const findRootSubject = (nodes) => nodes.find(
14441
14610
  invariant(xyflow2, "xyflow is not initialized"), invariant(xystore, "xystore is not initialized"), bounds ??= context2.layouted?.bounds;
14442
14611
  const maxZoom = Math.max(xyflow2.getZoom(), 1);
14443
14612
  if (bounds) {
14444
- const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, ViewPadding);
14613
+ const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, ViewPadding$1);
14445
14614
  xyflow2.setViewport(viewport, duration > 0 ? { duration } : void 0).catch(console.error);
14446
14615
  } else
14447
14616
  xyflow2.fitView({
14448
14617
  minZoom: MinZoom,
14449
14618
  maxZoom,
14450
- padding: ViewPadding,
14619
+ padding: ViewPadding$1,
14451
14620
  ...duration > 0 && { duration }
14452
14621
  }).catch(console.error);
14453
14622
  },
@@ -14871,7 +15040,10 @@ function inputToSubject(input2) {
14871
15040
  target: input2.target
14872
15041
  };
14873
15042
  }
14874
- const _relationshipDetailsLogic = xstate_cjsExports.setup({
15043
+ const ViewPadding = {
15044
+ x: "22px",
15045
+ y: "22px"
15046
+ }, _relationshipDetailsLogic = xstate_cjsExports.setup({
14875
15047
  types: {
14876
15048
  context: {},
14877
15049
  input: {},
@@ -14885,13 +15057,13 @@ const _relationshipDetailsLogic = xstate_cjsExports.setup({
14885
15057
  invariant(xyflow2, "xyflow is not initialized"), invariant(xystore, "xystore is not initialized"), bounds ??= context2.bounds;
14886
15058
  const maxZoom = Math.max(xyflow2.getZoom(), 1);
14887
15059
  if (bounds) {
14888
- const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, 0.1);
15060
+ const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, ViewPadding);
14889
15061
  xyflow2.setViewport(viewport, duration > 0 ? { duration } : void 0).catch(console.error);
14890
15062
  } else
14891
15063
  xyflow2.fitView({
14892
15064
  minZoom: MinZoom,
14893
15065
  maxZoom,
14894
- padding: 0.1,
15066
+ padding: ViewPadding,
14895
15067
  ...duration > 0 && { duration }
14896
15068
  }).catch(console.error);
14897
15069
  },
@@ -17285,7 +17457,7 @@ function LikeC4Diagram({
17285
17457
  enableRelationshipBrowser = !1,
17286
17458
  nodesDraggable = !readonly,
17287
17459
  nodesSelectable = !readonly || enableFocusMode || !!onNavigateTo || !!onNodeClick,
17288
- showNotations = !0,
17460
+ enableNotations = !1,
17289
17461
  showNavigationButtons = !!onNavigateTo,
17290
17462
  enableDynamicViewWalkthrough = !1,
17291
17463
  dynamicViewVariant,
@@ -17334,7 +17506,7 @@ function LikeC4Diagram({
17334
17506
  enableNavigationButtons: showNavigationButtons && !!onNavigateTo,
17335
17507
  enableDynamicViewWalkthrough: view._type === "dynamic" && enableDynamicViewWalkthrough,
17336
17508
  enableEdgeEditing: experimentalEdgeEditing,
17337
- enableNotations: showNotations,
17509
+ enableNotations,
17338
17510
  enableVscode: !!onOpenSource,
17339
17511
  enableControls: controls,
17340
17512
  enableElementTags
@@ -17444,7 +17616,7 @@ function StaticLikeC4Diagram({
17444
17616
  zoomable: !1,
17445
17617
  controls: !1,
17446
17618
  background,
17447
- showNotations: !1,
17619
+ enableNotations: !1,
17448
17620
  enableElementDetails: !1,
17449
17621
  enableRelationshipDetails,
17450
17622
  enableRelationshipBrowser,
@@ -1569,7 +1569,7 @@ function ExportPage() {
1569
1569
  pannable: !1,
1570
1570
  zoomable: !1,
1571
1571
  controls: !1,
1572
- showNotations: !1,
1572
+ enableNotations: !1,
1573
1573
  enableElementDetails: !1,
1574
1574
  enableRelationshipDetails: !1,
1575
1575
  enableRelationshipBrowser: !1,
@@ -1690,7 +1690,7 @@ function ViewReact() {
1690
1690
  enableRelationshipBrowser: !0,
1691
1691
  enableElementTags: !0,
1692
1692
  experimentalEdgeEditing: !1,
1693
- showNotations: hasNotations,
1693
+ enableNotations: hasNotations,
1694
1694
  nodesDraggable: !1,
1695
1695
  nodesSelectable: !0,
1696
1696
  onNavigateTo,
@@ -1951,7 +1951,7 @@ function ViewEditor() {
1951
1951
  right: "32px"
1952
1952
  },
1953
1953
  showNavigationButtons: !0,
1954
- showNotations: isDevelopment || hasNotations,
1954
+ enableNotations: isDevelopment || hasNotations,
1955
1955
  enableSearch: !0,
1956
1956
  enableDynamicViewWalkthrough: !0,
1957
1957
  enableFocusMode: !0,