@likec4/diagram 1.24.0 → 1.24.1

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 (116) hide show
  1. package/dist/LikeC4Diagram.css.d.ts +5 -0
  2. package/dist/LikeC4Diagram.css.js +1 -0
  3. package/dist/LikeC4Diagram.d.ts +1 -1
  4. package/dist/LikeC4Diagram.js +6 -2
  5. package/dist/LikeC4Diagram.props.d.ts +6 -0
  6. package/dist/base/BaseXYFlow.d.ts +1 -1
  7. package/dist/base/BaseXYFlow.js +12 -3
  8. package/dist/base/const.d.ts +1 -1
  9. package/dist/base/const.js +1 -1
  10. package/dist/base/primitives/compound/CompoundActionButton.css.js +2 -0
  11. package/dist/base/primitives/compound/CompoundDetailsButton.css.js +2 -0
  12. package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -1
  13. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +4 -4
  14. package/dist/base/primitives/compound/CompoundNodeContainer.js +35 -22
  15. package/dist/base/primitives/compound/CompoundTitle.css.js +3 -1
  16. package/dist/base/primitives/customNode.js +1 -1
  17. package/dist/base/primitives/edge/EdgeContainer.js +5 -4
  18. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -1
  19. package/dist/base/primitives/edge/EdgeLabel.css.js +2 -5
  20. package/dist/base/primitives/edge/EdgeLabel.js +5 -5
  21. package/dist/base/primitives/edge/edge.css.d.ts +1 -1
  22. package/dist/base/primitives/edge/edge.css.js +4 -5
  23. package/dist/base/primitives/element/ElementActionButtons.css.js +2 -0
  24. package/dist/base/primitives/element/ElementActionButtons.js +4 -3
  25. package/dist/base/primitives/element/ElementDetailsButton.css.js +2 -0
  26. package/dist/base/primitives/element/ElementNodeContainer.css.js +2 -0
  27. package/dist/base/primitives/element/ElementNodeContainer.js +3 -1
  28. package/dist/base/primitives/element/ElementShape.css.js +4 -2
  29. package/dist/base/primitives/element/ElementShape.js +2 -3
  30. package/dist/base/primitives/element/ElementTitle.css.js +2 -0
  31. package/dist/base/primitives/element/styles.css.js +2 -0
  32. package/dist/components/SearchControl.css.js +2 -0
  33. package/dist/context/FramerMotionConfig.d.ts +9 -1
  34. package/dist/context/FramerMotionConfig.js +5 -2
  35. package/dist/context/RootContainer.js +13 -1
  36. package/dist/diagram.css +1 -1
  37. package/dist/globals.css.d.ts +2 -0
  38. package/dist/hooks/safeContext.js +1 -0
  39. package/dist/hooks/useDiagram.d.ts +554 -864
  40. package/dist/hooks/useDiagram.js +1 -0
  41. package/dist/hooks/useIsReducedGraphics.d.ts +4 -0
  42. package/dist/hooks/useIsReducedGraphics.js +8 -0
  43. package/dist/hooks/useXYFlow.js +1 -1
  44. package/dist/likec4diagram/DiagramUI.d.ts +2 -1
  45. package/dist/likec4diagram/DiagramUI.js +5 -3
  46. package/dist/likec4diagram/custom/nodes/nodeTypes.js +2 -2
  47. package/dist/likec4diagram/ui/controls/styles.css.js +2 -0
  48. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.js +2 -0
  49. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +3 -4
  50. package/dist/likec4diagram/ui/search/LikeC4Search.css.js +2 -0
  51. package/dist/overlays/element-details/ElementDetailsCard.js +12 -8
  52. package/dist/overlays/element-details/actor.d.ts +9084 -2569
  53. package/dist/overlays/overlay/Overlay.js +6 -3
  54. package/dist/overlays/relationship-details/RelationshipDetails.js +31 -17
  55. package/dist/overlays/relationship-details/actor.d.ts +228 -3
  56. package/dist/overlays/relationship-details/actor.js +86 -14
  57. package/dist/overlays/relationship-details/hooks.d.ts +3 -0
  58. package/dist/overlays/relationship-details/hooks.js +6 -2
  59. package/dist/overlays/relationships-browser/-useRelationshipsView.js +12 -3
  60. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +12 -3
  61. package/dist/overlays/relationships-browser/actor.d.ts +271 -54
  62. package/dist/overlays/relationships-browser/actor.js +86 -23
  63. package/dist/state/DiagramActorProvider.js +12 -2
  64. package/dist/state/diagram-machine.d.ts +563 -867
  65. package/dist/state/diagram-machine.js +82 -81
  66. package/dist/state/persistence.d.ts +5 -0
  67. package/dist/state/persistence.js +23 -0
  68. package/package.json +9 -9
  69. package/src/LikeC4Diagram.css.ts +13 -5
  70. package/src/LikeC4Diagram.props.ts +7 -0
  71. package/src/LikeC4Diagram.tsx +33 -24
  72. package/src/base/BaseXYFlow.tsx +14 -9
  73. package/src/base/const.ts +1 -1
  74. package/src/base/primitives/compound/CompoundActionButton.css.ts +6 -0
  75. package/src/base/primitives/compound/CompoundDetailsButton.css.ts +4 -0
  76. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +41 -59
  77. package/src/base/primitives/compound/CompoundNodeContainer.tsx +42 -22
  78. package/src/base/primitives/compound/CompoundTitle.css.ts +14 -13
  79. package/src/base/primitives/customNode.ts +3 -2
  80. package/src/base/primitives/edge/EdgeContainer.tsx +4 -3
  81. package/src/base/primitives/edge/EdgeLabel.css.ts +17 -11
  82. package/src/base/primitives/edge/EdgeLabel.tsx +4 -4
  83. package/src/base/primitives/edge/edge.css.ts +47 -27
  84. package/src/base/primitives/element/ElementActionButtons.css.ts +4 -0
  85. package/src/base/primitives/element/ElementActionButtons.tsx +4 -2
  86. package/src/base/primitives/element/ElementDetailsButton.css.ts +6 -8
  87. package/src/base/primitives/element/ElementNodeContainer.css.ts +18 -21
  88. package/src/base/primitives/element/ElementNodeContainer.tsx +3 -1
  89. package/src/base/primitives/element/ElementShape.css.ts +10 -6
  90. package/src/base/primitives/element/ElementShape.tsx +2 -2
  91. package/src/components/SearchControl.css.ts +11 -4
  92. package/src/context/FramerMotionConfig.tsx +13 -2
  93. package/src/context/RootContainer.tsx +9 -2
  94. package/src/globals.css.ts +3 -0
  95. package/src/hooks/safeContext.tsx +2 -1
  96. package/src/hooks/useDiagram.ts +1 -0
  97. package/src/hooks/useIsReducedGraphics.ts +5 -0
  98. package/src/hooks/useXYFlow.ts +1 -1
  99. package/src/likec4diagram/DiagramUI.tsx +5 -3
  100. package/src/likec4diagram/custom/nodes/nodeTypes.tsx +2 -2
  101. package/src/likec4diagram/ui/controls/styles.css.ts +11 -1
  102. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.css.ts +10 -3
  103. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +6 -3
  104. package/src/likec4diagram/ui/search/LikeC4Search.css.ts +1 -0
  105. package/src/overlays/element-details/ElementDetailsCard.tsx +238 -231
  106. package/src/overlays/overlay/Overlay.css.ts +1 -9
  107. package/src/overlays/overlay/Overlay.tsx +6 -3
  108. package/src/overlays/relationship-details/RelationshipDetails.tsx +83 -66
  109. package/src/overlays/relationship-details/actor.ts +106 -13
  110. package/src/overlays/relationship-details/hooks.ts +6 -2
  111. package/src/overlays/relationships-browser/-useRelationshipsView.ts +10 -0
  112. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +16 -8
  113. package/src/overlays/relationships-browser/actor.ts +92 -22
  114. package/src/state/DiagramActorProvider.tsx +13 -2
  115. package/src/state/diagram-machine.ts +80 -79
  116. package/src/state/persistence.ts +22 -0
@@ -21,6 +21,7 @@ import {
21
21
  Divider as MantineDivider,
22
22
  Flex,
23
23
  Group,
24
+ RemoveScroll,
24
25
  ScrollArea,
25
26
  Stack,
26
27
  Tabs,
@@ -36,15 +37,17 @@ import { useSessionStorage, useViewportSize } from '@mantine/hooks'
36
37
  import { useDebouncedCallback, useSyncedRef, useTimeoutEffect } from '@react-hookz/web'
37
38
  import { IconExternalLink, IconFileSymlink, IconStack2, IconZoomScan } from '@tabler/icons-react'
38
39
  import type { Rect } from '@xyflow/system'
40
+ import clsx from 'clsx'
39
41
  import { type PanInfo, m, useDragControls, useMotionValue } from 'framer-motion'
40
42
  import { type PropsWithChildren, useCallback, useRef, useState } from 'react'
41
43
  import { clamp, isNullish, map, only, partition, pipe } from 'remeda'
42
44
  import { Link } from '../../components/Link'
43
45
  import { DiagramFeatures, IconRenderer, IfEnabled } from '../../context'
44
46
  import { useUpdateEffect } from '../../hooks'
45
- import { useDiagram, useDiagramContext } from '../../hooks/useDiagram'
47
+ import { useDiagram } from '../../hooks/useDiagram'
46
48
  import type { OnNavigateTo } from '../../LikeC4Diagram.props'
47
49
  import { useLikeC4Model } from '../../likec4model'
50
+ import { stopPropagation } from '../../utils'
48
51
  import * as css from './ElementDetailsCard.css'
49
52
  import { TabPanelDeployments } from './TabPanelDeployments'
50
53
  import { TabPanelRelationships } from './TabPanelRelationships'
@@ -210,16 +213,16 @@ export function ElementDetailsCard({
210
213
  if (!ref.current?.open) {
211
214
  ref.current?.showModal()
212
215
  }
213
- }, 30)
216
+ }, 20)
214
217
 
215
218
  useTimeoutEffect(() => {
216
219
  setOpened(true)
217
- }, 120)
220
+ }, 150)
218
221
 
219
222
  return (
220
223
  <m.dialog
221
224
  ref={ref}
222
- className={css.dialog}
225
+ className={clsx(css.dialog, RemoveScroll.classNames.fullWidth)}
223
226
  layout
224
227
  layoutRoot
225
228
  initial={{
@@ -238,252 +241,256 @@ export function ElementDetailsCard({
238
241
  },
239
242
  }}
240
243
  onClick={e => {
244
+ e.stopPropagation()
241
245
  if ((e.target as any)?.nodeName?.toUpperCase() === 'DIALOG') {
242
- e.stopPropagation()
243
246
  ref.current?.close()
244
247
  }
245
248
  }}
249
+ onDoubleClick={stopPropagation}
250
+ onPointerDown={stopPropagation}
246
251
  onClose={e => {
247
252
  e.stopPropagation()
248
253
  close()
249
254
  }}
250
255
  >
251
- <Card
252
- drag
253
- dragElastic={0}
254
- dragMomentum={false}
255
- dragListener={false}
256
- dragControls={controls}
257
- withBorder
258
- shadow="md"
259
- component={m.div}
260
- className={css.card}
261
- initial={{
262
- top,
263
- left,
264
- width: _width,
265
- height: _height,
266
- opacity: 0,
267
- originX,
268
- originY,
269
- scale: Math.max(fromScale, 0.7),
270
- }}
271
- animate={{
272
- opacity: 1,
273
- scale: 1,
274
- }}
275
- exit={{
276
- opacity: 0,
277
- scale: 0.9,
278
- translateY: -10,
279
- transition: {
280
- duration: 0.1,
281
- },
282
- }}
283
- style={{
284
- // `style` prop in Mantine doesn't accept motion values
285
- width: width as any,
286
- height: height as any,
287
- }}
288
- data-likec4-color={nodeModel?.color ?? elementModel.color}>
289
- <Box
290
- className={css.cardHeader}
291
- onPointerDown={e => controls.start(e)}>
292
- <Group align="start" justify="space-between" gap={'sm'} mb={'sm'} wrap="nowrap">
293
- <Group align="start" gap={'sm'} style={{ cursor: 'default' }} wrap="nowrap">
294
- {elementIcon}
295
- <Box>
296
- <Text
297
- component={'div'}
298
- className={css.title}>
299
- {elementModel.title}
300
- </Text>
301
- {notation && (
302
- <Text component="div" c={'dimmed'} fz={'sm'} fw={500} lh={1.3} lineClamp={1}>
303
- {notation}
256
+ <RemoveScroll forwardProps removeScrollBar={false}>
257
+ <Card
258
+ drag
259
+ dragElastic={0}
260
+ dragMomentum={false}
261
+ dragListener={false}
262
+ dragControls={controls}
263
+ withBorder
264
+ shadow="md"
265
+ component={m.div}
266
+ className={css.card}
267
+ initial={{
268
+ top,
269
+ left,
270
+ width: _width,
271
+ height: _height,
272
+ opacity: 0,
273
+ originX,
274
+ originY,
275
+ scale: Math.max(fromScale, 0.7),
276
+ }}
277
+ animate={{
278
+ opacity: 1,
279
+ scale: 1,
280
+ }}
281
+ exit={{
282
+ opacity: 0,
283
+ scale: 0.9,
284
+ translateY: -10,
285
+ transition: {
286
+ duration: 0.1,
287
+ },
288
+ }}
289
+ style={{
290
+ // `style` prop in Mantine doesn't accept motion values
291
+ width: width as any,
292
+ height: height as any,
293
+ }}
294
+ data-likec4-color={nodeModel?.color ?? elementModel.color}>
295
+ <Box
296
+ className={css.cardHeader}
297
+ onPointerDown={e => controls.start(e)}>
298
+ <Group align="start" justify="space-between" gap={'sm'} mb={'sm'} wrap="nowrap">
299
+ <Group align="start" gap={'sm'} style={{ cursor: 'default' }} wrap="nowrap">
300
+ {elementIcon}
301
+ <Box>
302
+ <Text
303
+ component={'div'}
304
+ className={css.title}>
305
+ {elementModel.title}
304
306
  </Text>
305
- )}
306
- </Box>
307
+ {notation && (
308
+ <Text component="div" c={'dimmed'} fz={'sm'} fw={500} lh={1.3} lineClamp={1}>
309
+ {notation}
310
+ </Text>
311
+ )}
312
+ </Box>
313
+ </Group>
314
+ <CloseButton
315
+ size={'lg'}
316
+ onClick={e => {
317
+ e.stopPropagation()
318
+ close()
319
+ }} />
307
320
  </Group>
308
- <CloseButton
309
- size={'lg'}
310
- onClick={e => {
311
- e.stopPropagation()
312
- close()
313
- }} />
314
- </Group>
315
- <Group align="baseline" gap={'sm'} wrap="nowrap">
316
- <Box>
317
- <SmallLabel>kind</SmallLabel>
318
- <Badge radius={'sm'} size="sm" fw={600} color="gray">{elementModel.kind}</Badge>
319
- </Box>
320
- <Box flex={1}>
321
- <SmallLabel>tags</SmallLabel>
322
- <Flex gap={4} flex={1} mt={6}>
323
- {elementModel.tags.map((tag) => (
324
- <Badge key={tag} radius={'sm'} size="sm" fw={600} variant="gradient">#{tag}</Badge>
325
- ))}
326
- {elementModel.tags.length === 0 && <Badge radius={'sm'} size="sm" fw={600} color="gray">—</Badge>}
327
- </Flex>
328
- </Box>
329
- <ActionIconGroup
330
- style={{
331
- alignSelf: 'flex-end',
332
- }}>
333
- {defaultLink && (
334
- <ActionIcon
335
- component="a"
336
- href={defaultLink.url}
337
- target="_blank"
338
- size="lg"
339
- variant="default"
340
- radius="sm"
341
- >
342
- <IconExternalLink stroke={1.6} style={{ width: '65%' }} />
343
- </ActionIcon>
344
- )}
345
- <IfEnabled feature="Vscode">
346
- <Tooltip label="Open source">
347
- <ActionIcon
348
- size="lg"
349
- variant="default"
350
- radius="sm"
351
- onClick={e => {
352
- e.stopPropagation()
353
- // diagram.openSource({
354
- // element: elementModel.id,
355
- // })
356
- }}>
357
- <IconFileSymlink stroke={1.8} style={{ width: '62%' }} />
358
- </ActionIcon>
359
- </Tooltip>
360
- </IfEnabled>
361
- {defaultView && (
362
- <Tooltip label="Open default view">
321
+ <Group align="baseline" gap={'sm'} wrap="nowrap">
322
+ <Box>
323
+ <SmallLabel>kind</SmallLabel>
324
+ <Badge radius={'sm'} size="sm" fw={600} color="gray">{elementModel.kind}</Badge>
325
+ </Box>
326
+ <Box flex={1}>
327
+ <SmallLabel>tags</SmallLabel>
328
+ <Flex gap={4} flex={1} mt={6}>
329
+ {elementModel.tags.map((tag) => (
330
+ <Badge key={tag} radius={'sm'} size="sm" fw={600} variant="gradient">#{tag}</Badge>
331
+ ))}
332
+ {elementModel.tags.length === 0 && <Badge radius={'sm'} size="sm" fw={600} color="gray">—</Badge>}
333
+ </Flex>
334
+ </Box>
335
+ <ActionIconGroup
336
+ style={{
337
+ alignSelf: 'flex-end',
338
+ }}>
339
+ {defaultLink && (
363
340
  <ActionIcon
341
+ component="a"
342
+ href={defaultLink.url}
343
+ target="_blank"
364
344
  size="lg"
365
345
  variant="default"
366
346
  radius="sm"
367
- onClick={e => {
368
- e.stopPropagation()
369
- diagram.navigateTo(defaultView.id, fromNode ?? undefined)
370
- }}>
371
- <IconZoomScan style={{ width: '70%' }} />
347
+ >
348
+ <IconExternalLink stroke={1.6} style={{ width: '65%' }} />
372
349
  </ActionIcon>
373
- </Tooltip>
374
- )}
375
- </ActionIconGroup>
376
- </Group>
377
- </Box>
378
- <Tabs
379
- value={activeTab}
380
- onChange={v => setActiveTab(v as any)}
381
- variant="none"
382
- classNames={{
383
- root: css.tabsRoot,
384
- list: css.tabsList,
385
- tab: css.tabsTab,
386
- panel: css.tabsPanel,
387
- }}>
388
- <TabsList>
389
- {TABS.map(tab => (
390
- <TabsTab key={tab} value={tab}>
391
- {tab}
392
- </TabsTab>
393
- ))}
394
- </TabsList>
395
-
396
- <TabsPanel value="Properties">
397
- <ScrollArea scrollbars="y" type="auto">
398
- <Box className={css.propertiesGrid} pt={'xs'}>
399
- <ElementProperty title="description" emptyValue="no description">
400
- {elementModel.description}
401
- </ElementProperty>
402
- {elementModel.technology && (
403
- <ElementProperty title="technology">
404
- {elementModel.technology}
405
- </ElementProperty>
406
350
  )}
407
- {elementModel.links.length > 0 && (
408
- <>
409
- <PropertyLabel>links</PropertyLabel>
410
- <Stack gap={'xs'} align="flex-start">
411
- {elementModel.links.map((link, i) => <Link key={i} value={link} />)}
412
- </Stack>
413
- </>
351
+ <IfEnabled feature="Vscode">
352
+ <Tooltip label="Open source">
353
+ <ActionIcon
354
+ size="lg"
355
+ variant="default"
356
+ radius="sm"
357
+ onClick={e => {
358
+ e.stopPropagation()
359
+ // diagram.openSource({
360
+ // element: elementModel.id,
361
+ // })
362
+ }}>
363
+ <IconFileSymlink stroke={1.8} style={{ width: '62%' }} />
364
+ </ActionIcon>
365
+ </Tooltip>
366
+ </IfEnabled>
367
+ {defaultView && (
368
+ <Tooltip label="Open default view">
369
+ <ActionIcon
370
+ size="lg"
371
+ variant="default"
372
+ radius="sm"
373
+ onClick={e => {
374
+ e.stopPropagation()
375
+ diagram.navigateTo(defaultView.id, fromNode ?? undefined)
376
+ }}>
377
+ <IconZoomScan style={{ width: '70%' }} />
378
+ </ActionIcon>
379
+ </Tooltip>
414
380
  )}
415
- {elementModel.$element.metadata && <ElementMetata value={elementModel.$element.metadata} />}
416
- </Box>
417
- </ScrollArea>
418
- </TabsPanel>
419
-
420
- <TabsPanel value="Relationships">
421
- <DiagramFeatures
422
- overrides={{
423
- enableRelationshipBrowser: false,
424
- enableNavigateTo: false,
425
- }}>
426
- {opened && activeTab === 'Relationships' && (
427
- <TabPanelRelationships
428
- element={elementModel}
429
- node={nodeModel ?? null} />
430
- )}
431
- </DiagramFeatures>
432
- </TabsPanel>
433
-
434
- <TabsPanel value="Views">
435
- <ScrollArea scrollbars="y" type="auto">
436
- <Stack gap={'lg'}>
437
- {viewsOf.length > 0 && (
438
- <Box>
439
- <Divider label="views of the element (scoped)" />
440
- <Stack gap={'sm'}>
441
- {viewsOf.map((view) => (
442
- <ViewButton
443
- key={view.id}
444
- view={view}
445
- onNavigateTo={to => diagram.navigateTo(to, fromNode ?? undefined)} />
446
- ))}
447
- </Stack>
448
- </Box>
449
- )}
450
- {otherViews.length > 0 && (
451
- <Box>
452
- <Divider label="views including this element" />
453
- <Stack gap={'sm'}>
454
- {otherViews.map((view) => (
455
- <ViewButton
456
- key={view.id}
457
- view={view}
458
- onNavigateTo={to => diagram.navigateTo(to, fromNode ?? undefined)} />
459
- ))}
460
- </Stack>
461
- </Box>
381
+ </ActionIconGroup>
382
+ </Group>
383
+ </Box>
384
+ <Tabs
385
+ value={activeTab}
386
+ onChange={v => setActiveTab(v as any)}
387
+ variant="none"
388
+ classNames={{
389
+ root: css.tabsRoot,
390
+ list: css.tabsList,
391
+ tab: css.tabsTab,
392
+ panel: css.tabsPanel,
393
+ }}>
394
+ <TabsList>
395
+ {TABS.map(tab => (
396
+ <TabsTab key={tab} value={tab}>
397
+ {tab}
398
+ </TabsTab>
399
+ ))}
400
+ </TabsList>
401
+
402
+ <TabsPanel value="Properties">
403
+ <ScrollArea scrollbars="y" type="auto">
404
+ <Box className={css.propertiesGrid} pt={'xs'}>
405
+ <ElementProperty title="description" emptyValue="no description">
406
+ {elementModel.description}
407
+ </ElementProperty>
408
+ {elementModel.technology && (
409
+ <ElementProperty title="technology">
410
+ {elementModel.technology}
411
+ </ElementProperty>
412
+ )}
413
+ {elementModel.links.length > 0 && (
414
+ <>
415
+ <PropertyLabel>links</PropertyLabel>
416
+ <Stack gap={'xs'} align="flex-start">
417
+ {elementModel.links.map((link, i) => <Link key={i} value={link} />)}
418
+ </Stack>
419
+ </>
420
+ )}
421
+ {elementModel.$element.metadata && <ElementMetata value={elementModel.$element.metadata} />}
422
+ </Box>
423
+ </ScrollArea>
424
+ </TabsPanel>
425
+
426
+ <TabsPanel value="Relationships">
427
+ <DiagramFeatures
428
+ overrides={{
429
+ enableRelationshipBrowser: false,
430
+ enableNavigateTo: false,
431
+ }}>
432
+ {opened && activeTab === 'Relationships' && (
433
+ <TabPanelRelationships
434
+ element={elementModel}
435
+ node={nodeModel ?? null} />
462
436
  )}
463
- </Stack>
464
- </ScrollArea>
465
- </TabsPanel>
466
-
467
- <TabsPanel value="Structure">
468
- <ScrollArea scrollbars="y" type="auto">
469
- <TabPanelStructure element={elementModel} />
470
- </ScrollArea>
471
- </TabsPanel>
472
-
473
- <TabsPanel value="Deployments">
474
- <ScrollArea scrollbars="y" type="auto">
475
- <TabPanelDeployments elementFqn={elementModel.id} />
476
- </ScrollArea>
477
- </TabsPanel>
478
- </Tabs>
479
- <m.div
480
- className={css.resizeHandle}
481
- drag
482
- dragElastic={0}
483
- dragMomentum={false}
484
- onDrag={handleDrag}
485
- dragConstraints={{ top: 0, left: 0, right: 0, bottom: 0 }} />
486
- </Card>
437
+ </DiagramFeatures>
438
+ </TabsPanel>
439
+
440
+ <TabsPanel value="Views">
441
+ <ScrollArea scrollbars="y" type="auto">
442
+ <Stack gap={'lg'}>
443
+ {viewsOf.length > 0 && (
444
+ <Box>
445
+ <Divider label="views of the element (scoped)" />
446
+ <Stack gap={'sm'}>
447
+ {viewsOf.map((view) => (
448
+ <ViewButton
449
+ key={view.id}
450
+ view={view}
451
+ onNavigateTo={to => diagram.navigateTo(to, fromNode ?? undefined)} />
452
+ ))}
453
+ </Stack>
454
+ </Box>
455
+ )}
456
+ {otherViews.length > 0 && (
457
+ <Box>
458
+ <Divider label="views including this element" />
459
+ <Stack gap={'sm'}>
460
+ {otherViews.map((view) => (
461
+ <ViewButton
462
+ key={view.id}
463
+ view={view}
464
+ onNavigateTo={to => diagram.navigateTo(to, fromNode ?? undefined)} />
465
+ ))}
466
+ </Stack>
467
+ </Box>
468
+ )}
469
+ </Stack>
470
+ </ScrollArea>
471
+ </TabsPanel>
472
+
473
+ <TabsPanel value="Structure">
474
+ <ScrollArea scrollbars="y" type="auto">
475
+ <TabPanelStructure element={elementModel} />
476
+ </ScrollArea>
477
+ </TabsPanel>
478
+
479
+ <TabsPanel value="Deployments">
480
+ <ScrollArea scrollbars="y" type="auto">
481
+ <TabPanelDeployments elementFqn={elementModel.id} />
482
+ </ScrollArea>
483
+ </TabsPanel>
484
+ </Tabs>
485
+ <m.div
486
+ className={css.resizeHandle}
487
+ drag
488
+ dragElastic={0}
489
+ dragMomentum={false}
490
+ onDrag={handleDrag}
491
+ dragConstraints={{ top: 0, left: 0, right: 0, bottom: 0 }} />
492
+ </Card>
493
+ </RemoveScroll>
487
494
  </m.dialog>
488
495
  )
489
496
  }
@@ -42,7 +42,7 @@ export const dialog = style({
42
42
  borderRadius: mantine.radius.sm,
43
43
  inset: '2rem',
44
44
  width: 'calc(100vw - 4rem)',
45
- maxWidth: 'calc(100vw - 4rem)',
45
+ height: 'calc(100vh - 4rem)',
46
46
  },
47
47
  [mantine.smallerThan('sm')]: {
48
48
  border: 'none',
@@ -59,16 +59,8 @@ export const body = style({
59
59
  containerType: 'size',
60
60
  border: `0 solid transparent`,
61
61
  borderRadius: calc(borderRadius).subtract('2px').toString(),
62
- // borderRadius: borderRadius,
63
62
  backgroundColor: mantine.colors.body,
64
63
  overflow: 'hidden',
65
64
  width: '100%',
66
65
  height: '100%',
67
- // visibility: 'hidden',
68
- // selectors: {
69
- // [`${dialog}[open] &`]: {
70
- // visibility: 'visible',
71
- // },
72
- // },
73
- // backgroundColor: 'red',
74
66
  })
@@ -6,6 +6,7 @@ import { useDebouncedCallback, useSyncedRef, useTimeoutEffect } from '@react-hoo
6
6
  import clsx from 'clsx'
7
7
  import { type HTMLMotionProps, m } from 'framer-motion'
8
8
  import { type PropsWithChildren, useLayoutEffect, useRef, useState } from 'react'
9
+ import { stopPropagation } from '../../utils'
9
10
  import * as css from './Overlay.css'
10
11
 
11
12
  type OverlayProps = PropsWithChildren<
@@ -65,7 +66,7 @@ export function Overlay({ children, onClose, className, classes, ...rest }: Over
65
66
  return (
66
67
  <m.dialog
67
68
  ref={dialogRef}
68
- className={clsx(css.dialog, classes?.dialog, className)}
69
+ className={clsx(css.dialog, classes?.dialog, className, RemoveScroll.classNames.fullWidth)}
69
70
  initial={{
70
71
  '--backdrop-blur': '0px',
71
72
  '--backdrop-opacity': '5%',
@@ -92,19 +93,21 @@ export function Overlay({ children, onClose, className, classes, ...rest }: Over
92
93
  },
93
94
  }}
94
95
  onClick={e => {
96
+ e.stopPropagation()
95
97
  if ((e.target as any)?.nodeName?.toUpperCase() === 'DIALOG') {
96
- e.stopPropagation()
97
98
  dialogRef.current?.close()
98
99
  return
99
100
  }
100
101
  }}
102
+ onDoubleClick={stopPropagation}
103
+ onPointerDown={stopPropagation}
101
104
  onClose={e => {
102
105
  e.stopPropagation()
103
106
  close()
104
107
  }}
105
108
  {...rest}
106
109
  >
107
- <RemoveScroll forwardProps>
110
+ <RemoveScroll forwardProps removeScrollBar={false}>
108
111
  <Box className={clsx(css.body, classes?.body)}>
109
112
  {opened && <>{children}</>}
110
113
  </Box>