@redocly/theme 0.57.0-next.0 → 0.57.0-next.2

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 (108) hide show
  1. package/lib/components/Catalog/CatalogCardView/CatalogCard.js +1 -0
  2. package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +36 -25
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.d.ts +6 -0
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.js +38 -0
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts +6 -0
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +83 -0
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +2 -0
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +29 -0
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.d.ts +8 -0
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +33 -0
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.d.ts +16 -0
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.js +24 -0
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.d.ts +7 -0
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +30 -0
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +5 -2
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +1 -0
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +7 -3
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +3 -8
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +22 -0
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +18 -0
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +2 -2
  22. package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
  23. package/lib/components/Catalog/CatalogEntityIcon.js +4 -6
  24. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
  25. package/lib/components/Catalog/variables.js +42 -0
  26. package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +13 -8
  27. package/lib/core/constants/catalog.d.ts +10 -0
  28. package/lib/core/constants/catalog.js +14 -1
  29. package/lib/core/hooks/__mocks__/search/use-recent-searches.d.ts +2 -2
  30. package/lib/core/hooks/__mocks__/search/use-recent-searches.js +2 -1
  31. package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +2 -2
  32. package/lib/core/hooks/__mocks__/search/use-search-filter.js +2 -1
  33. package/lib/core/hooks/__mocks__/search/use-suggested-pages.d.ts +2 -2
  34. package/lib/core/hooks/__mocks__/search/use-suggested-pages.js +2 -1
  35. package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +1 -1
  36. package/lib/core/hooks/__mocks__/use-controlled-state.js +2 -1
  37. package/lib/core/hooks/__mocks__/use-input-key-commands.d.ts +3 -3
  38. package/lib/core/hooks/__mocks__/use-input-key-commands.js +3 -2
  39. package/lib/core/hooks/__mocks__/use-mobile-menu.d.ts +1 -1
  40. package/lib/core/hooks/__mocks__/use-mobile-menu.js +2 -1
  41. package/lib/core/hooks/__mocks__/use-theme-config.d.ts +2 -2
  42. package/lib/core/hooks/__mocks__/use-theme-config.js +2 -1
  43. package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +47 -47
  44. package/lib/core/hooks/__mocks__/use-theme-hooks.js +38 -37
  45. package/lib/core/hooks/__mocks__/use-time-ago.d.ts +2 -2
  46. package/lib/core/hooks/__mocks__/use-time-ago.js +2 -1
  47. package/lib/core/hooks/catalog/useGraph.d.ts +15 -0
  48. package/lib/core/hooks/catalog/useGraph.js +165 -0
  49. package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +4 -3
  50. package/lib/core/hooks/index.d.ts +1 -0
  51. package/lib/core/hooks/index.js +1 -0
  52. package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.d.ts +1 -1
  53. package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.js +2 -1
  54. package/lib/core/hooks/use-page-actions.js +5 -1
  55. package/lib/core/openapi/index.d.ts +1 -0
  56. package/lib/core/openapi/index.js +3 -1
  57. package/lib/core/styles/index.d.ts +1 -0
  58. package/lib/core/styles/index.js +3 -0
  59. package/lib/core/styles/xyflow.d.ts +1 -0
  60. package/lib/core/styles/xyflow.js +623 -0
  61. package/lib/core/utils/dynamic.d.ts +9 -0
  62. package/lib/core/utils/dynamic.js +59 -0
  63. package/lib/core/utils/index.d.ts +1 -0
  64. package/lib/core/utils/index.js +1 -0
  65. package/lib/icons/GenericIcon/GenericIcon.d.ts +2 -2
  66. package/lib/icons/GenericIcon/GenericIcon.js +8 -3
  67. package/lib/icons/__tests__/IconTestUtils.d.ts +0 -1
  68. package/lib/icons/__tests__/IconTestUtils.js +8 -7
  69. package/package.json +11 -14
  70. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -0
  71. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +60 -42
  72. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.tsx +63 -0
  73. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +7 -0
  74. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +91 -0
  75. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +48 -0
  76. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.tsx +45 -0
  77. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +49 -0
  78. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +6 -2
  79. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +8 -2
  80. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +24 -43
  81. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +76 -0
  82. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +2 -2
  83. package/src/components/Catalog/CatalogEntityIcon.tsx +7 -5
  84. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -1
  85. package/src/components/Catalog/variables.ts +42 -0
  86. package/src/components/CatalogClassic/CatalogClassicVirtualizedGroups.tsx +29 -18
  87. package/src/core/constants/catalog.ts +13 -0
  88. package/src/core/hooks/__mocks__/search/use-recent-searches.ts +3 -1
  89. package/src/core/hooks/__mocks__/search/use-search-filter.ts +3 -1
  90. package/src/core/hooks/__mocks__/search/use-suggested-pages.ts +3 -1
  91. package/src/core/hooks/__mocks__/use-controlled-state.ts +3 -1
  92. package/src/core/hooks/__mocks__/use-input-key-commands.ts +4 -2
  93. package/src/core/hooks/__mocks__/use-mobile-menu.ts +3 -1
  94. package/src/core/hooks/__mocks__/use-theme-config.ts +3 -1
  95. package/src/core/hooks/__mocks__/use-theme-hooks.ts +39 -37
  96. package/src/core/hooks/__mocks__/use-time-ago.ts +3 -1
  97. package/src/core/hooks/catalog/useGraph.ts +236 -0
  98. package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +5 -3
  99. package/src/core/hooks/index.ts +1 -0
  100. package/src/core/hooks/menu/__mocks__/use-mobile-menu-items.ts +3 -1
  101. package/src/core/hooks/use-page-actions.ts +5 -1
  102. package/src/core/openapi/index.ts +1 -0
  103. package/src/core/styles/index.ts +1 -0
  104. package/src/core/styles/xyflow.ts +620 -0
  105. package/src/core/utils/dynamic.tsx +85 -0
  106. package/src/core/utils/index.ts +1 -0
  107. package/src/icons/GenericIcon/GenericIcon.tsx +13 -4
  108. package/src/icons/__tests__/IconTestUtils.tsx +5 -4
@@ -0,0 +1,620 @@
1
+ import { css } from 'styled-components';
2
+
3
+ // Need to be in a separate file because webpack doesn't support direct import of css files
4
+ export const xyflow = css`
5
+ .react-flow {
6
+ direction: ltr;
7
+
8
+ --xy-edge-stroke-default: #b1b1b7;
9
+ --xy-edge-stroke-width-default: 1;
10
+ --xy-edge-stroke-selected-default: #555;
11
+
12
+ --xy-connectionline-stroke-default: #b1b1b7;
13
+ --xy-connectionline-stroke-width-default: 1;
14
+
15
+ --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);
16
+
17
+ --xy-minimap-background-color-default: #fff;
18
+ --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);
19
+ --xy-minimap-mask-stroke-color-default: transparent;
20
+ --xy-minimap-mask-stroke-width-default: 1;
21
+ --xy-minimap-node-background-color-default: #e2e2e2;
22
+ --xy-minimap-node-stroke-color-default: transparent;
23
+ --xy-minimap-node-stroke-width-default: 2;
24
+
25
+ --xy-background-color-default: transparent;
26
+ --xy-background-pattern-dots-color-default: #91919a;
27
+ --xy-background-pattern-lines-color-default: #eee;
28
+ --xy-background-pattern-cross-color-default: #e2e2e2;
29
+ background-color: var(--xy-background-color, var(--xy-background-color-default));
30
+ --xy-node-color-default: inherit;
31
+ --xy-node-border-default: 1px solid #1a192b;
32
+ --xy-node-background-color-default: #fff;
33
+ --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);
34
+ --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);
35
+ --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;
36
+ --xy-node-border-radius-default: 3px;
37
+
38
+ --xy-handle-background-color-default: #1a192b;
39
+ --xy-handle-border-color-default: #fff;
40
+
41
+ --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);
42
+ --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);
43
+
44
+ --xy-controls-button-background-color-default: #fefefe;
45
+ --xy-controls-button-background-color-hover-default: #f4f4f4;
46
+ --xy-controls-button-color-default: inherit;
47
+ --xy-controls-button-color-hover-default: inherit;
48
+ --xy-controls-button-border-color-default: #eee;
49
+ --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);
50
+
51
+ --xy-edge-label-background-color-default: #ffffff;
52
+ --xy-edge-label-color-default: inherit;
53
+ --xy-resize-background-color-default: #3367d9;
54
+ }
55
+ .react-flow.dark {
56
+ --xy-edge-stroke-default: #3e3e3e;
57
+ --xy-edge-stroke-width-default: 1;
58
+ --xy-edge-stroke-selected-default: #727272;
59
+
60
+ --xy-connectionline-stroke-default: #b1b1b7;
61
+ --xy-connectionline-stroke-width-default: 1;
62
+
63
+ --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);
64
+
65
+ --xy-minimap-background-color-default: #141414;
66
+ --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);
67
+ --xy-minimap-mask-stroke-color-default: transparent;
68
+ --xy-minimap-mask-stroke-width-default: 1;
69
+ --xy-minimap-node-background-color-default: #2b2b2b;
70
+ --xy-minimap-node-stroke-color-default: transparent;
71
+ --xy-minimap-node-stroke-width-default: 2;
72
+
73
+ --xy-background-color-default: #141414;
74
+ --xy-background-pattern-dots-color-default: #777;
75
+ --xy-background-pattern-lines-color-default: #777;
76
+ --xy-background-pattern-cross-color-default: #777;
77
+ --xy-node-color-default: #f8f8f8;
78
+ --xy-node-border-default: 1px solid #3c3c3c;
79
+ --xy-node-background-color-default: #1e1e1e;
80
+ --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);
81
+ --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);
82
+ --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;
83
+
84
+ --xy-handle-background-color-default: #bebebe;
85
+ --xy-handle-border-color-default: #1e1e1e;
86
+
87
+ --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);
88
+ --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);
89
+
90
+ --xy-controls-button-background-color-default: #2b2b2b;
91
+ --xy-controls-button-background-color-hover-default: #3e3e3e;
92
+ --xy-controls-button-color-default: #f8f8f8;
93
+ --xy-controls-button-color-hover-default: #fff;
94
+ --xy-controls-button-border-color-default: #5b5b5b;
95
+ --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);
96
+
97
+ --xy-edge-label-background-color-default: #141414;
98
+ --xy-edge-label-color-default: #f8f8f8;
99
+ }
100
+ .react-flow__background {
101
+ background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));
102
+ pointer-events: none;
103
+ z-index: -1;
104
+ }
105
+ .react-flow__container {
106
+ position: absolute;
107
+ width: 100%;
108
+ height: 100%;
109
+ top: 0;
110
+ left: 0;
111
+ }
112
+ .react-flow__pane {
113
+ z-index: 1;
114
+ }
115
+ .react-flow__pane.draggable {
116
+ cursor: grab;
117
+ }
118
+ .react-flow__pane.dragging {
119
+ cursor: grabbing;
120
+ }
121
+ .react-flow__pane.selection {
122
+ cursor: pointer;
123
+ }
124
+ .react-flow__viewport {
125
+ transform-origin: 0 0;
126
+ z-index: 2;
127
+ pointer-events: none;
128
+ }
129
+ .react-flow__renderer {
130
+ z-index: 4;
131
+ }
132
+ .react-flow__selection {
133
+ z-index: 6;
134
+ }
135
+ .react-flow__nodesselection-rect:focus,
136
+ .react-flow__nodesselection-rect:focus-visible {
137
+ outline: none;
138
+ }
139
+ .react-flow__edge-path {
140
+ stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));
141
+ stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));
142
+ fill: none;
143
+ }
144
+ .react-flow__connection-path {
145
+ stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));
146
+ stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));
147
+ fill: none;
148
+ }
149
+ .react-flow .react-flow__edges {
150
+ position: absolute;
151
+ }
152
+ .react-flow .react-flow__edges svg {
153
+ overflow: visible;
154
+ position: absolute;
155
+ pointer-events: none;
156
+ }
157
+ .react-flow__edge {
158
+ pointer-events: visibleStroke;
159
+ }
160
+ .react-flow__edge.selectable {
161
+ cursor: pointer;
162
+ }
163
+ .react-flow__edge.animated path {
164
+ stroke-dasharray: 5;
165
+ animation: dashdraw 0.5s linear infinite;
166
+ }
167
+ .react-flow__edge.animated path.react-flow__edge-interaction {
168
+ stroke-dasharray: none;
169
+ animation: none;
170
+ }
171
+ .react-flow__edge.inactive {
172
+ pointer-events: none;
173
+ }
174
+ .react-flow__edge.selected,
175
+ .react-flow__edge:focus,
176
+ .react-flow__edge:focus-visible {
177
+ outline: none;
178
+ }
179
+ .react-flow__edge.selected .react-flow__edge-path,
180
+ .react-flow__edge.selectable:focus .react-flow__edge-path,
181
+ .react-flow__edge.selectable:focus-visible .react-flow__edge-path {
182
+ stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));
183
+ }
184
+ .react-flow__edge-textwrapper {
185
+ pointer-events: all;
186
+ }
187
+ .react-flow__edge .react-flow__edge-text {
188
+ pointer-events: none;
189
+ -webkit-user-select: none;
190
+ -moz-user-select: none;
191
+ user-select: none;
192
+ }
193
+ .react-flow__connection {
194
+ pointer-events: none;
195
+ }
196
+ .react-flow__connection .animated {
197
+ stroke-dasharray: 5;
198
+ animation: dashdraw 0.5s linear infinite;
199
+ }
200
+ svg.react-flow__connectionline {
201
+ z-index: 1001;
202
+ overflow: visible;
203
+ position: absolute;
204
+ }
205
+ .react-flow__nodes {
206
+ pointer-events: none;
207
+ transform-origin: 0 0;
208
+ }
209
+ .react-flow__node {
210
+ position: absolute;
211
+ -webkit-user-select: none;
212
+ -moz-user-select: none;
213
+ user-select: none;
214
+ pointer-events: all;
215
+ transform-origin: 0 0;
216
+ box-sizing: border-box;
217
+ cursor: default;
218
+ }
219
+ .react-flow__node.selectable {
220
+ cursor: pointer;
221
+ }
222
+ .react-flow__node.draggable {
223
+ cursor: grab;
224
+ pointer-events: all;
225
+ }
226
+ .react-flow__node.draggable.dragging {
227
+ cursor: grabbing;
228
+ }
229
+ .react-flow__nodesselection {
230
+ z-index: 3;
231
+ transform-origin: left top;
232
+ pointer-events: none;
233
+ }
234
+ .react-flow__nodesselection-rect {
235
+ position: absolute;
236
+ pointer-events: all;
237
+ cursor: grab;
238
+ }
239
+ .react-flow__handle {
240
+ position: absolute;
241
+ pointer-events: none;
242
+ min-width: 5px;
243
+ min-height: 5px;
244
+ width: 6px;
245
+ height: 6px;
246
+ background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));
247
+ border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));
248
+ border-radius: 100%;
249
+ }
250
+ .react-flow__handle.connectingfrom {
251
+ pointer-events: all;
252
+ }
253
+ .react-flow__handle.connectionindicator {
254
+ pointer-events: all;
255
+ cursor: crosshair;
256
+ }
257
+ .react-flow__handle-bottom {
258
+ top: auto;
259
+ left: 50%;
260
+ bottom: 0;
261
+ transform: translate(-50%, 50%);
262
+ }
263
+ .react-flow__handle-top {
264
+ top: 0;
265
+ left: 50%;
266
+ transform: translate(-50%, -50%);
267
+ }
268
+ .react-flow__handle-left {
269
+ top: 50%;
270
+ left: 0;
271
+ transform: translate(-50%, -50%);
272
+ }
273
+ .react-flow__handle-right {
274
+ top: 50%;
275
+ right: 0;
276
+ transform: translate(50%, -50%);
277
+ }
278
+ .react-flow__edgeupdater {
279
+ cursor: move;
280
+ pointer-events: all;
281
+ }
282
+ .react-flow__pane.selection .react-flow__panel {
283
+ pointer-events: none;
284
+ }
285
+ .react-flow__panel {
286
+ position: absolute;
287
+ z-index: 5;
288
+ margin: 15px;
289
+ }
290
+ .react-flow__panel.top {
291
+ top: 0;
292
+ }
293
+ .react-flow__panel.bottom {
294
+ bottom: 0;
295
+ }
296
+ .react-flow__panel.top.center, .react-flow__panel.bottom.center {
297
+ left: 50%;
298
+ transform: translateX(-15px) translateX(-50%);
299
+ }
300
+ .react-flow__panel.left {
301
+ left: 0;
302
+ }
303
+ .react-flow__panel.right {
304
+ right: 0;
305
+ }
306
+ .react-flow__panel.left.center, .react-flow__panel.right.center {
307
+ top: 50%;
308
+ transform: translateY(-15px) translateY(-50%);
309
+ }
310
+ .react-flow__attribution {
311
+ font-size: 10px;
312
+ background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));
313
+ padding: 2px 3px;
314
+ margin: 0;
315
+ }
316
+ .react-flow__attribution a {
317
+ text-decoration: none;
318
+ color: #999;
319
+ }
320
+ @keyframes dashdraw {
321
+ from {
322
+ stroke-dashoffset: 10;
323
+ }
324
+ }
325
+ .react-flow__edgelabel-renderer {
326
+ position: absolute;
327
+ width: 100%;
328
+ height: 100%;
329
+ pointer-events: none;
330
+ -webkit-user-select: none;
331
+ -moz-user-select: none;
332
+ user-select: none;
333
+ left: 0;
334
+ top: 0;
335
+ }
336
+ .react-flow__viewport-portal {
337
+ position: absolute;
338
+ width: 100%;
339
+ height: 100%;
340
+ left: 0;
341
+ top: 0;
342
+ -webkit-user-select: none;
343
+ -moz-user-select: none;
344
+ user-select: none;
345
+ }
346
+ .react-flow__minimap {
347
+ background: var(
348
+ --xy-minimap-background-color-props,
349
+ var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))
350
+ );
351
+ }
352
+ .react-flow__minimap-svg {
353
+ display: block;
354
+ }
355
+ .react-flow__minimap-mask {
356
+ fill: var(
357
+ --xy-minimap-mask-background-color-props,
358
+ var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))
359
+ );
360
+ stroke: var(
361
+ --xy-minimap-mask-stroke-color-props,
362
+ var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))
363
+ );
364
+ stroke-width: var(
365
+ --xy-minimap-mask-stroke-width-props,
366
+ var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))
367
+ );
368
+ }
369
+ .react-flow__minimap-node {
370
+ fill: var(
371
+ --xy-minimap-node-background-color-props,
372
+ var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))
373
+ );
374
+ stroke: var(
375
+ --xy-minimap-node-stroke-color-props,
376
+ var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))
377
+ );
378
+ stroke-width: var(
379
+ --xy-minimap-node-stroke-width-props,
380
+ var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))
381
+ );
382
+ }
383
+ .react-flow__background-pattern.dots {
384
+ fill: var(
385
+ --xy-background-pattern-color-props,
386
+ var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))
387
+ );
388
+ }
389
+ .react-flow__background-pattern.lines {
390
+ stroke: var(
391
+ --xy-background-pattern-color-props,
392
+ var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))
393
+ );
394
+ }
395
+ .react-flow__background-pattern.cross {
396
+ stroke: var(
397
+ --xy-background-pattern-color-props,
398
+ var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))
399
+ );
400
+ }
401
+ .react-flow__controls {
402
+ display: flex;
403
+ flex-direction: column;
404
+ box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));
405
+ }
406
+ .react-flow__controls.horizontal {
407
+ flex-direction: row;
408
+ }
409
+ .react-flow__controls-button {
410
+ display: flex;
411
+ justify-content: center;
412
+ align-items: center;
413
+ height: 26px;
414
+ width: 26px;
415
+ padding: 4px;
416
+ border: none;
417
+ background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));
418
+ border-bottom: 1px solid
419
+ var(
420
+ --xy-controls-button-border-color-props,
421
+ var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))
422
+ );
423
+ color: var(
424
+ --xy-controls-button-color-props,
425
+ var(--xy-controls-button-color, var(--xy-controls-button-color-default))
426
+ );
427
+ cursor: pointer;
428
+ -webkit-user-select: none;
429
+ -moz-user-select: none;
430
+ user-select: none;
431
+ }
432
+ .react-flow__controls-button svg {
433
+ width: 100%;
434
+ max-width: 12px;
435
+ max-height: 12px;
436
+ fill: currentColor;
437
+ }
438
+ .react-flow__edge.updating .react-flow__edge-path {
439
+ stroke: #777;
440
+ }
441
+ .react-flow__edge-text {
442
+ font-size: 10px;
443
+ }
444
+ .react-flow__node.selectable:focus,
445
+ .react-flow__node.selectable:focus-visible {
446
+ outline: none;
447
+ }
448
+ .react-flow__node-input,
449
+ .react-flow__node-default,
450
+ .react-flow__node-output,
451
+ .react-flow__node-group {
452
+ padding: 10px;
453
+ border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));
454
+ width: 150px;
455
+ font-size: 12px;
456
+ color: var(--xy-node-color, var(--xy-node-color-default));
457
+ text-align: center;
458
+ border: var(--xy-node-border, var(--xy-node-border-default));
459
+ background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));
460
+ }
461
+ .react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {
462
+ box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));
463
+ }
464
+ .react-flow__node-input.selectable.selected,
465
+ .react-flow__node-input.selectable:focus,
466
+ .react-flow__node-input.selectable:focus-visible,
467
+ .react-flow__node-default.selectable.selected,
468
+ .react-flow__node-default.selectable:focus,
469
+ .react-flow__node-default.selectable:focus-visible,
470
+ .react-flow__node-output.selectable.selected,
471
+ .react-flow__node-output.selectable:focus,
472
+ .react-flow__node-output.selectable:focus-visible,
473
+ .react-flow__node-group.selectable.selected,
474
+ .react-flow__node-group.selectable:focus,
475
+ .react-flow__node-group.selectable:focus-visible {
476
+ box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));
477
+ }
478
+ .react-flow__node-group {
479
+ background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));
480
+ }
481
+ .react-flow__nodesselection-rect,
482
+ .react-flow__selection {
483
+ background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));
484
+ border: var(--xy-selection-border, var(--xy-selection-border-default));
485
+ }
486
+ .react-flow__nodesselection-rect:focus,
487
+ .react-flow__nodesselection-rect:focus-visible,
488
+ .react-flow__selection:focus,
489
+ .react-flow__selection:focus-visible {
490
+ outline: none;
491
+ }
492
+ .react-flow__controls-button:hover {
493
+ background: var(
494
+ --xy-controls-button-background-color-hover-props,
495
+ var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))
496
+ );
497
+ color: var(
498
+ --xy-controls-button-color-hover-props,
499
+ var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))
500
+ );
501
+ }
502
+ .react-flow__controls-button:disabled {
503
+ pointer-events: none;
504
+ }
505
+ .react-flow__controls-button:disabled svg {
506
+ fill-opacity: 0.4;
507
+ }
508
+ .react-flow__controls-button:last-child {
509
+ border-bottom: none;
510
+ }
511
+ .react-flow__controls.horizontal .react-flow__controls-button {
512
+ border-bottom: none;
513
+ border-right: 1px solid
514
+ var(
515
+ --xy-controls-button-border-color-props,
516
+ var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))
517
+ );
518
+ }
519
+ .react-flow__controls.horizontal .react-flow__controls-button:last-child {
520
+ border-right: none;
521
+ }
522
+ .react-flow__resize-control {
523
+ position: absolute;
524
+ }
525
+ .react-flow__resize-control.left,
526
+ .react-flow__resize-control.right {
527
+ cursor: ew-resize;
528
+ }
529
+ .react-flow__resize-control.top,
530
+ .react-flow__resize-control.bottom {
531
+ cursor: ns-resize;
532
+ }
533
+ .react-flow__resize-control.top.left,
534
+ .react-flow__resize-control.bottom.right {
535
+ cursor: nwse-resize;
536
+ }
537
+ .react-flow__resize-control.bottom.left,
538
+ .react-flow__resize-control.top.right {
539
+ cursor: nesw-resize;
540
+ }
541
+ /* handle styles */
542
+ .react-flow__resize-control.handle {
543
+ width: 5px;
544
+ height: 5px;
545
+ border: 1px solid #fff;
546
+ border-radius: 1px;
547
+ background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
548
+ translate: -50% -50%;
549
+ }
550
+ .react-flow__resize-control.handle.left {
551
+ left: 0;
552
+ top: 50%;
553
+ }
554
+ .react-flow__resize-control.handle.right {
555
+ left: 100%;
556
+ top: 50%;
557
+ }
558
+ .react-flow__resize-control.handle.top {
559
+ left: 50%;
560
+ top: 0;
561
+ }
562
+ .react-flow__resize-control.handle.bottom {
563
+ left: 50%;
564
+ top: 100%;
565
+ }
566
+ .react-flow__resize-control.handle.top.left {
567
+ left: 0;
568
+ }
569
+ .react-flow__resize-control.handle.bottom.left {
570
+ left: 0;
571
+ }
572
+ .react-flow__resize-control.handle.top.right {
573
+ left: 100%;
574
+ }
575
+ .react-flow__resize-control.handle.bottom.right {
576
+ left: 100%;
577
+ }
578
+ /* line styles */
579
+ .react-flow__resize-control.line {
580
+ border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));
581
+ border-width: 0;
582
+ border-style: solid;
583
+ }
584
+ .react-flow__resize-control.line.left,
585
+ .react-flow__resize-control.line.right {
586
+ width: 1px;
587
+ transform: translate(-50%, 0);
588
+ top: 0;
589
+ height: 100%;
590
+ }
591
+ .react-flow__resize-control.line.left {
592
+ left: 0;
593
+ border-left-width: 1px;
594
+ }
595
+ .react-flow__resize-control.line.right {
596
+ left: 100%;
597
+ border-right-width: 1px;
598
+ }
599
+ .react-flow__resize-control.line.top,
600
+ .react-flow__resize-control.line.bottom {
601
+ height: 1px;
602
+ transform: translate(0, -50%);
603
+ left: 0;
604
+ width: 100%;
605
+ }
606
+ .react-flow__resize-control.line.top {
607
+ top: 0;
608
+ border-top-width: 1px;
609
+ }
610
+ .react-flow__resize-control.line.bottom {
611
+ border-bottom-width: 1px;
612
+ top: 100%;
613
+ }
614
+ .react-flow__edge-textbg {
615
+ fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));
616
+ }
617
+ .react-flow__edge-text {
618
+ fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));
619
+ }
620
+ `;
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+
3
+ interface DynamicOptions<TProps extends Record<string, unknown>> {
4
+ ssr?: boolean;
5
+ loading?: React.ComponentType<TProps>;
6
+ }
7
+
8
+ export function dynamic<TProps extends Record<string, unknown>>(
9
+ factory: () => Promise<
10
+ React.ComponentType<TProps> | { default: React.ComponentType<TProps> } | Record<string, unknown>
11
+ >,
12
+ { ssr = true, loading }: DynamicOptions<TProps> = {},
13
+ ): React.ComponentType<TProps> {
14
+ const Component = React.lazy(() =>
15
+ factory().then((mod) => {
16
+ // Case 1: factory() => import('./SomeModule') - direct import
17
+ // Case 2: factory() => import('./SomeModule').then(mod => mod.default) - extract default
18
+ if (typeof mod === 'function') {
19
+ return { default: mod };
20
+ }
21
+
22
+ // Case 3: factory() => import('./SomeModule').then(mod => ({ default: mod.default })) - manual wrap
23
+ // Case 4: factory() => import('./SomeModule').then(mod => ({ default: mod.Named })) - manual wrap named
24
+ if (mod && typeof mod === 'object' && 'default' in mod) {
25
+ const defaultExport = mod.default;
26
+
27
+ // Handle both function components and React component objects (e.g., memo/forwardRef)
28
+ if (typeof defaultExport === 'function') {
29
+ return { default: defaultExport as React.ComponentType<TProps> };
30
+ }
31
+
32
+ if (defaultExport && typeof defaultExport === 'object' && '$$typeof' in defaultExport) {
33
+ return { default: defaultExport as React.ComponentType<TProps> };
34
+ }
35
+ }
36
+
37
+ // Case 5: factory() => import('./SomeModule').then(mod => mod.Named) - find named export
38
+ if (mod && typeof mod === 'object') {
39
+ const modObj = mod as Record<string, unknown>;
40
+
41
+ for (const key in modObj) {
42
+ const value = modObj[key];
43
+
44
+ if (typeof value === 'function') {
45
+ return { default: value as React.ComponentType<TProps> };
46
+ }
47
+
48
+ if (value && typeof value === 'object' && '$$typeof' in value) {
49
+ return { default: value as React.ComponentType<TProps> };
50
+ }
51
+ }
52
+ }
53
+
54
+ throw new Error('Dynamic import did not return a valid React component');
55
+ }),
56
+ );
57
+
58
+ const LoadingComponent: React.ComponentType<TProps> = loading || (() => null);
59
+
60
+ return (props: TProps) => {
61
+ const [hasMounted, setHasMounted] = React.useState(false);
62
+
63
+ React.useEffect(() => {
64
+ setHasMounted(true);
65
+ }, []);
66
+
67
+ if (ssr) {
68
+ return (
69
+ <React.Suspense fallback={<LoadingComponent {...props} />}>
70
+ <Component {...props} />
71
+ </React.Suspense>
72
+ );
73
+ }
74
+
75
+ if (!hasMounted) {
76
+ return <LoadingComponent {...props} />;
77
+ }
78
+
79
+ return (
80
+ <React.Suspense fallback={<LoadingComponent {...props} />}>
81
+ <Component {...props} />
82
+ </React.Suspense>
83
+ );
84
+ };
85
+ }
@@ -36,3 +36,4 @@ export * from './parse-style-string';
36
36
  export * from './lang-to-name';
37
37
  export * from './enhanced-smoothstep';
38
38
  export * from './icon-resolver';
39
+ export * from './dynamic';