@eventcatalog/core 2.19.4 → 2.19.6

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.
@@ -0,0 +1,333 @@
1
+ /* imported from @stoplight/mosaic/themes/default.css */
2
+ /* Don't import directly from node_module as react peer dep issues, we only use the CSS so just import it like this for now */
3
+ :root,
4
+ [data-theme="light"],
5
+ [data-theme="light"] .sl-inverted .sl-inverted,
6
+ [data-theme="light"] .sl-inverted .sl-inverted .sl-inverted .sl-inverted {
7
+ color: var(--color-text);
8
+
9
+ --text-h: 0;
10
+ --text-s: 0%;
11
+ --text-l: 15%;
12
+ --shadow-sm: 0px 0px 1px rgba(67, 90, 111, 0.3);
13
+ --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.25), 0px 0px 1px rgba(67, 90, 111, 0.3);
14
+ --shadow-lg: 0 4px 17px rgba(67, 90, 111, .2), 0 2px 3px rgba(0, 0, 0, .1), inset 0 0 0 .5px var(--color-canvas-pure), 0 0 0 .5px rgba(0, 0, 0, 0.2);
15
+ --shadow-xl: 0px 0px 1px rgba(67, 90, 111, 0.3), 0px 8px 10px -4px rgba(67, 90, 111, 0.45);
16
+ --shadow-2xl: 0px 0px 1px rgba(67, 90, 111, 0.3), 0px 16px 24px -8px rgba(67, 90, 111, 0.45);
17
+ --drop-shadow-default1: 0 0 0.5px rgba(0, 0, 0, 0.6);
18
+ --drop-shadow-default2: 0 2px 5px rgba(67, 90, 111, 0.3);
19
+ --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 15)), 1);
20
+ --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1);
21
+ --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9);
22
+ --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7);
23
+ --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55);
24
+ --color-text-disabled: hsla(var(--text-h), var(--text-s), var(--text-l), 0.3);
25
+ --canvas-h: 218;
26
+ --canvas-s: 40%;
27
+ --canvas-l: 100%;
28
+ --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1);
29
+ --color-canvas-dark: hsla(218, 23%, 23%, 1);
30
+ --color-canvas-pure: hsla(218, 40%, 100%, 1);
31
+ --color-canvas-tint: hsla(218, 32%, 97%, 0.5);
32
+ --color-canvas-50: hsla(218, 32%, 97%, 1);
33
+ --color-canvas-100: hsla(218, 33%, 94%, 1);
34
+ --color-canvas-200: hsla(218, 35%, 91%, 1);
35
+ --color-canvas-300: hsla(218, 36%, 88%, 1);
36
+ --color-canvas-400: hsla(218, 37%, 85%, 1);
37
+ --color-canvas-500: hsla(218, 37%, 82%, 1);
38
+ --color-canvas-dialog: hsla(218, 40%, 100%, 1);
39
+ --color-border-dark: hsla(var(--canvas-h), 30%, 72%, 0.5);
40
+ --color-border: hsla(var(--canvas-h), 32%, 78%, 0.5);
41
+ --color-border-light: hsla(var(--canvas-h), 24%, 84%, 0.5);
42
+ --color-border-input: hsla(var(--canvas-h), 24%, 72%, 0.8);
43
+ --color-border-button: hsla(var(--canvas-h), 24%, 20%, 0.65);
44
+ --primary-h: 202;
45
+ --primary-s: 100%;
46
+ --primary-l: 55%;
47
+ --color-text-primary: hsla(202, 100%, 40%, 1);
48
+ --color-primary-dark: hsla(202, 80%, 47%, 1);
49
+ --color-primary-darker: hsla(202, 80%, 36%, 1);
50
+ --color-primary: hsla(202, 100%, 55%, 1);
51
+ --color-primary-light: hsla(202, 100%, 66%, 1);
52
+ --color-primary-tint: hsla(202, 100%, 65%, 0.25);
53
+ --color-on-primary: hsla(202, 100%, 100%, 1);
54
+ --success-h: 156;
55
+ --success-s: 95%;
56
+ --success-l: 37%;
57
+ --color-text-success: hsla(156, 95%, 40%, 1);
58
+ --color-success-dark: hsla(156, 76%, 31%, 1);
59
+ --color-success-darker: hsla(156, 76%, 24%, 1);
60
+ --color-success: hsla(156, 95%, 37%, 1);
61
+ --color-success-light: hsla(156, 95%, 44%, 1);
62
+ --color-success-tint: hsla(156, 95%, 65%, 0.25);
63
+ --color-on-success: hsla(156, 95%, 100%, 1);
64
+ --warning-h: 20;
65
+ --warning-s: 90%;
66
+ --warning-l: 56%;
67
+ --color-text-warning: hsla(20, 90%, 40%, 1);
68
+ --color-warning-dark: hsla(20, 72%, 48%, 1);
69
+ --color-warning-darker: hsla(20, 72%, 36%, 1);
70
+ --color-warning: hsla(20, 90%, 56%, 1);
71
+ --color-warning-light: hsla(20, 90%, 67%, 1);
72
+ --color-warning-tint: hsla(20, 90%, 65%, 0.25);
73
+ --color-on-warning: hsla(20, 90%, 100%, 1);
74
+ --danger-h: 0;
75
+ --danger-s: 84%;
76
+ --danger-l: 63%;
77
+ --color-text-danger: hsla(0, 84%, 40%, 1);
78
+ --color-danger-dark: hsla(0, 67%, 54%, 1);
79
+ --color-danger-darker: hsla(0, 67%, 41%, 1);
80
+ --color-danger: hsla(0, 84%, 63%, 1);
81
+ --color-danger-light: hsla(0, 84%, 76%, 1);
82
+ --color-danger-tint: hsla(0, 84%, 65%, 0.25);
83
+ --color-on-danger: hsla(0, 84%, 100%, 1);
84
+
85
+ }
86
+
87
+ :root .sl-inverted,
88
+ [data-theme="light"] .sl-inverted,
89
+ [data-theme="light"] .sl-inverted .sl-inverted .sl-inverted {
90
+ color: var(--color-text);
91
+
92
+ --text-h: 0;
93
+ --text-s: 0%;
94
+ --text-l: 86%;
95
+ --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5);
96
+ --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4);
97
+ --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.2);
98
+ --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55);
99
+ --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55);
100
+ --drop-shadow-default1: 0 0 0.5px rgba(255, 255, 255, .5);
101
+ --drop-shadow-default2: 0 3px 8px rgba(0, 0, 0, 0.6);
102
+ --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 15)), 1);
103
+ --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1);
104
+ --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9);
105
+ --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7);
106
+ --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55);
107
+ --color-text-disabled: hsla(var(--text-h), var(--text-s), var(--text-l), 0.3);
108
+ --canvas-h: 218;
109
+ --canvas-s: 32%;
110
+ --canvas-l: 10%;
111
+ --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1);
112
+ --color-canvas-dark: hsla(218, 23%, 23%, 1);
113
+ --color-canvas-pure: hsla(218, 32%, 7%, 1);
114
+ --color-canvas-tint: hsla(218, 26%, 32%, 0.2);
115
+ --color-canvas-50: hsla(218, 26%, 32%, 1);
116
+ --color-canvas-100: hsla(218, 27%, 24%, 1);
117
+ --color-canvas-200: hsla(218, 28%, 18%, 1);
118
+ --color-canvas-300: hsla(218, 29%, 14%, 1);
119
+ --color-canvas-400: hsla(218, 30%, 13%, 1);
120
+ --color-canvas-500: hsla(218, 30%, 12%, 1);
121
+ --color-canvas-dialog: hsla(218, 27%, 24%, 1);
122
+ --color-border-dark: hsla(var(--canvas-h), 24%, 23%, 0.5);
123
+ --color-border: hsla(var(--canvas-h), 26%, 28%, 0.5);
124
+ --color-border-light: hsla(var(--canvas-h), 19%, 34%, 0.5);
125
+ --color-border-input: hsla(var(--canvas-h), 19%, 30%, 0.8);
126
+ --color-border-button: hsla(var(--canvas-h), 19%, 80%, 0.65);
127
+ --primary-h: 202;
128
+ --primary-s: 90%;
129
+ --primary-l: 51%;
130
+ --color-text-primary: hsla(202, 100%, 70%, 1);
131
+ --color-primary-dark: hsla(202, 72%, 43%, 1);
132
+ --color-primary-darker: hsla(202, 72%, 33%, 1);
133
+ --color-primary: hsla(202, 90%, 51%, 1);
134
+ --color-primary-light: hsla(202, 90%, 61%, 1);
135
+ --color-primary-tint: hsla(202, 90%, 65%, 0.25);
136
+ --color-on-primary: hsla(202, 100%, 100%, 1);
137
+ --success-h: 156;
138
+ --success-s: 95%;
139
+ --success-l: 67%;
140
+ --color-text-success: hsla(156, 86%, 60%, 1);
141
+ --color-success-dark: hsla(156, 68%, 57%, 1);
142
+ --color-success-darker: hsla(156, 68%, 44%, 1);
143
+ --color-success: hsla(156, 86%, 67%, 1);
144
+ --color-success-light: hsla(156, 86%, 80%, 1);
145
+ --color-success-tint: hsla(156, 86%, 65%, 0.25);
146
+ --color-on-success: hsla(156, 95%, 100%, 1);
147
+ --warning-h: 20;
148
+ --warning-s: 90%;
149
+ --warning-l: 50%;
150
+ --color-text-warning: hsla(20, 81%, 60%, 1);
151
+ --color-warning-dark: hsla(20, 65%, 43%, 1);
152
+ --color-warning-darker: hsla(20, 65%, 33%, 1);
153
+ --color-warning: hsla(20, 81%, 50%, 1);
154
+ --color-warning-light: hsla(20, 81%, 60%, 1);
155
+ --color-warning-tint: hsla(20, 81%, 65%, 0.25);
156
+ --color-on-warning: hsla(20, 90%, 100%, 1);
157
+ --danger-h: 0;
158
+ --danger-s: 84%;
159
+ --danger-l: 43%;
160
+ --color-text-danger: hsla(0, 76%, 60%, 1);
161
+ --color-danger-dark: hsla(0, 60%, 37%, 1);
162
+ --color-danger-darker: hsla(0, 60%, 28%, 1);
163
+ --color-danger: hsla(0, 76%, 43%, 1);
164
+ --color-danger-light: hsla(0, 76%, 52%, 1);
165
+ --color-danger-tint: hsla(0, 76%, 65%, 0.25);
166
+ --color-on-danger: hsla(0, 84%, 100%, 1);
167
+
168
+ }
169
+ [data-theme="dark"],
170
+ [data-theme="dark"] .sl-inverted .sl-inverted,
171
+ [data-theme="dark"] .sl-inverted .sl-inverted .sl-inverted .sl-inverted {
172
+ color: var(--color-text);
173
+
174
+ --text-h: 0;
175
+ --text-s: 0%;
176
+ --text-l: 85%;
177
+ --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5);
178
+ --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4);
179
+ --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.2);
180
+ --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55);
181
+ --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55);
182
+ --drop-shadow-default1: 0 0 0.5px rgba(255, 255, 255, .5);
183
+ --drop-shadow-default2: 0 3px 8px rgba(0, 0, 0, 0.6);
184
+ --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 15)), 1);
185
+ --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1);
186
+ --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9);
187
+ --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7);
188
+ --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55);
189
+ --color-text-disabled: hsla(var(--text-h), var(--text-s), var(--text-l), 0.3);
190
+ --canvas-h: 218;
191
+ --canvas-s: 32%;
192
+ --canvas-l: 8%;
193
+ --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1);
194
+ --color-canvas-dark: hsla(218, 23%, 23%, 1);
195
+ --color-canvas-pure: hsla(218, 32%, 5%, 1);
196
+ --color-canvas-tint: hsla(218, 26%, 30%, 0.2);
197
+ --color-canvas-50: hsla(218, 26%, 20%, 1);
198
+ --color-canvas-100: hsla(218, 27%, 14%, 1);
199
+ --color-canvas-200: hsla(218, 28%, 10%, 1);
200
+ --color-canvas-300: hsla(218, 29%, 8%, 1);
201
+ --color-canvas-400: hsla(218, 30%, 7%, 1);
202
+ --color-canvas-500: hsla(218, 30%, 7%, 1);
203
+ --color-canvas-dialog: hsla(218, 27%, 14%, 1);
204
+ --color-border-dark: hsla(var(--canvas-h), 24%, 21%, 0.5);
205
+ --color-border: hsla(var(--canvas-h), 26%, 26%, 0.5);
206
+ --color-border-light: hsla(var(--canvas-h), 19%, 32%, 0.5);
207
+ --color-border-input: hsla(var(--canvas-h), 19%, 28%, 0.8);
208
+ --color-border-button: hsla(var(--canvas-h), 19%, 80%, 0.65);
209
+ --primary-h: 202;
210
+ --primary-s: 80%;
211
+ --primary-l: 36%;
212
+ --color-text-primary: hsla(202, 100%, 70%, 1);
213
+ --color-primary-dark: hsla(202, 64%, 30%, 1);
214
+ --color-primary-darker: hsla(202, 64%, 23%, 1);
215
+ --color-primary: hsla(202, 80%, 36%, 1);
216
+ --color-primary-light: hsla(202, 80%, 43%, 1);
217
+ --color-primary-tint: hsla(202, 80%, 42%, 0.25);
218
+ --color-on-primary: hsla(202, 100%, 100%, 1);
219
+ --success-h: 156;
220
+ --success-s: 95%;
221
+ --success-l: 37%;
222
+ --color-text-success: hsla(156, 76%, 60%, 1);
223
+ --color-success-dark: hsla(156, 61%, 20%, 1);
224
+ --color-success-darker: hsla(156, 61%, 16%, 1);
225
+ --color-success: hsla(156, 76%, 24%, 1);
226
+ --color-success-light: hsla(156, 76%, 29%, 1);
227
+ --color-success-tint: hsla(156, 76%, 42%, 0.25);
228
+ --color-on-success: hsla(156, 95%, 100%, 1);
229
+ --warning-h: 20;
230
+ --warning-s: 90%;
231
+ --warning-l: 56%;
232
+ --color-text-warning: hsla(20, 72%, 60%, 1);
233
+ --color-warning-dark: hsla(20, 58%, 31%, 1);
234
+ --color-warning-darker: hsla(20, 58%, 24%, 1);
235
+ --color-warning: hsla(20, 72%, 36%, 1);
236
+ --color-warning-light: hsla(20, 72%, 44%, 1);
237
+ --color-warning-tint: hsla(20, 72%, 42%, 0.25);
238
+ --color-on-warning: hsla(20, 90%, 100%, 1);
239
+ --danger-h: 0;
240
+ --danger-s: 84%;
241
+ --danger-l: 63%;
242
+ --color-text-danger: hsla(0, 67%, 60%, 1);
243
+ --color-danger-dark: hsla(0, 54%, 35%, 1);
244
+ --color-danger-darker: hsla(0, 54%, 27%, 1);
245
+ --color-danger: hsla(0, 67%, 41%, 1);
246
+ --color-danger-light: hsla(0, 67%, 49%, 1);
247
+ --color-danger-tint: hsla(0, 67%, 42%, 0.25);
248
+ --color-on-danger: hsla(0, 84%, 100%, 1);
249
+
250
+ }
251
+
252
+
253
+ [data-theme="dark"] .sl-inverted,
254
+ [data-theme="dark"] .sl-inverted .sl-inverted .sl-inverted {
255
+ color: var(--color-text);
256
+
257
+ --text-h: 0;
258
+ --text-s: 0%;
259
+ --text-l: 89%;
260
+ --shadow-sm: 0px 0px 1px rgba(11, 13, 19, 0.5);
261
+ --shadow-md: 0px 2px 4px -2px rgba(0, 0, 0, 0.35), 0px 0px 1px rgba(11, 13, 19, 0.4);
262
+ --shadow-lg: 0 2px 14px rgba(0,0,0,.55), 0 0 0 0.5px rgba(255,255,255,.2);
263
+ --shadow-xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 8px 10px -4px rgba(11, 13, 19, 0.55);
264
+ --shadow-2xl: 0px 0px 1px rgba(11, 13, 19, 0.4), 0px 16px 24px -8px rgba(11, 13, 19, 0.55);
265
+ --drop-shadow-default1: 0 0 0.5px rgba(255, 255, 255, .5);
266
+ --drop-shadow-default2: 0 3px 8px rgba(0, 0, 0, 0.6);
267
+ --color-text-heading: hsla(var(--text-h), var(--text-s), max(3, calc(var(--text-l) - 15)), 1);
268
+ --color-text: hsla(var(--text-h), var(--text-s), var(--text-l), 1);
269
+ --color-text-paragraph: hsla(var(--text-h), var(--text-s), var(--text-l), 0.9);
270
+ --color-text-muted: hsla(var(--text-h), var(--text-s), var(--text-l), 0.7);
271
+ --color-text-light: hsla(var(--text-h), var(--text-s), var(--text-l), 0.55);
272
+ --color-text-disabled: hsla(var(--text-h), var(--text-s), var(--text-l), 0.3);
273
+ --canvas-h: 218;
274
+ --canvas-s: 32%;
275
+ --canvas-l: 13%;
276
+ --color-canvas: hsla(var(--canvas-h), var(--canvas-s), var(--canvas-l), 1);
277
+ --color-canvas-dark: hsla(218, 23%, 23%, 1);
278
+ --color-canvas-pure: hsla(218, 32%, 10%, 1);
279
+ --color-canvas-tint: hsla(218, 26%, 35%, 0.2);
280
+ --color-canvas-50: hsla(218, 26%, 23%, 1);
281
+ --color-canvas-100: hsla(218, 27%, 18%, 1);
282
+ --color-canvas-200: hsla(218, 28%, 14%, 1);
283
+ --color-canvas-300: hsla(218, 29%, 11%, 1);
284
+ --color-canvas-400: hsla(218, 30%, 10%, 1);
285
+ --color-canvas-500: hsla(218, 30%, 10%, 1);
286
+ --color-canvas-dialog: hsla(218, 27%, 18%, 1);
287
+ --color-border-dark: hsla(var(--canvas-h), 24%, 26%, 0.5);
288
+ --color-border: hsla(var(--canvas-h), 26%, 31%, 0.5);
289
+ --color-border-light: hsla(var(--canvas-h), 19%, 37%, 0.5);
290
+ --color-border-input: hsla(var(--canvas-h), 19%, 33%, 0.8);
291
+ --color-border-button: hsla(var(--canvas-h), 19%, 80%, 0.65);
292
+ --primary-h: 202;
293
+ --primary-s: 80%;
294
+ --primary-l: 33%;
295
+ --color-text-primary: hsla(202, 100%, 70%, 1);
296
+ --color-primary-dark: hsla(202, 64%, 28%, 1);
297
+ --color-primary-darker: hsla(202, 64%, 22%, 1);
298
+ --color-primary: hsla(202, 80%, 33%, 1);
299
+ --color-primary-light: hsla(202, 80%, 40%, 1);
300
+ --color-primary-tint: hsla(202, 80%, 42%, 0.25);
301
+ --color-on-primary: hsla(202, 100%, 100%, 1);
302
+ --success-h: 156;
303
+ --success-s: 95%;
304
+ --success-l: 67%;
305
+ --color-text-success: hsla(156, 76%, 60%, 1);
306
+ --color-success-dark: hsla(156, 61%, 37%, 1);
307
+ --color-success-darker: hsla(156, 61%, 28%, 1);
308
+ --color-success: hsla(156, 76%, 44%, 1);
309
+ --color-success-light: hsla(156, 76%, 52%, 1);
310
+ --color-success-tint: hsla(156, 76%, 42%, 0.25);
311
+ --color-on-success: hsla(156, 95%, 100%, 1);
312
+ --warning-h: 20;
313
+ --warning-s: 90%;
314
+ --warning-l: 50%;
315
+ --color-text-warning: hsla(20, 72%, 60%, 1);
316
+ --color-warning-dark: hsla(20, 58%, 28%, 1);
317
+ --color-warning-darker: hsla(20, 58%, 21%, 1);
318
+ --color-warning: hsla(20, 72%, 33%, 1);
319
+ --color-warning-light: hsla(20, 72%, 39%, 1);
320
+ --color-warning-tint: hsla(20, 72%, 42%, 0.25);
321
+ --color-on-warning: hsla(20, 90%, 100%, 1);
322
+ --danger-h: 0;
323
+ --danger-s: 84%;
324
+ --danger-l: 43%;
325
+ --color-text-danger: hsla(0, 67%, 60%, 1);
326
+ --color-danger-dark: hsla(0, 54%, 24%, 1);
327
+ --color-danger-darker: hsla(0, 54%, 18%, 1);
328
+ --color-danger: hsla(0, 67%, 28%, 1);
329
+ --color-danger-light: hsla(0, 67%, 34%, 1);
330
+ --color-danger-tint: hsla(0, 67%, 42%, 0.25);
331
+ --color-on-danger: hsla(0, 84%, 100%, 1);
332
+
333
+ }
@@ -9,34 +9,100 @@ import {
9
9
  useReactTable,
10
10
  type Column,
11
11
  type ColumnFiltersState,
12
- type Row,
13
12
  } from '@tanstack/react-table';
14
- import type { CollectionEntry } from 'astro:content';
15
13
  import DebouncedInput from './DebouncedInput';
16
14
 
17
15
  import { getColumnsByCollection } from './columns';
18
- import { useEffect, useMemo, useState, type EventHandler } from 'react';
19
- import type { CollectionTypes } from '@types';
16
+ import { useEffect, useMemo, useState } from 'react';
17
+ import type { CollectionMessageTypes } from '@types';
20
18
  import { isSameVersion } from '@utils/collections/util';
21
19
 
22
20
  declare module '@tanstack/react-table' {
23
21
  // @ts-ignore
24
22
  interface ColumnMeta<TData extends RowData, TValue> {
25
23
  filterVariant?: 'collection' | 'name' | 'badges';
26
- collectionFilterKey?: string;
24
+ collectionFilterKey?: 'producers' | 'consumers' | 'sends' | 'receives' | 'services';
27
25
  showFilter?: boolean;
28
26
  className?: string;
29
27
  }
30
28
  }
31
29
 
32
- export const Table = ({
30
+ export type TCollectionTypes = 'domains' | 'services' | CollectionMessageTypes | 'flows';
31
+
32
+ export type TData<T extends TCollectionTypes> = {
33
+ collection: T;
34
+ data: {
35
+ id: string;
36
+ name: string;
37
+ summary: string;
38
+ version: string;
39
+ latestVersion?: string; // Defined on getter collection utility
40
+ badges?: Array<{
41
+ id: string; // Where is it defined?
42
+ content: string;
43
+ backgroundColor: string;
44
+ textColor: string;
45
+ icon: any; // Where is it defined?
46
+ }>;
47
+ // ---------------------------------------------------------------------------
48
+ // Domains
49
+ services?: Array<{
50
+ collection: string; // Be more specific;
51
+ data: {
52
+ id: string;
53
+ name: string;
54
+ version: string;
55
+ };
56
+ }>;
57
+ // ---------------------------------------------------------------------------
58
+ // Services
59
+ receives?: Array<{
60
+ collection: string; // Be more specific;
61
+ data: {
62
+ id: string;
63
+ name: string;
64
+ version: string;
65
+ };
66
+ }>;
67
+ sends?: Array<{
68
+ collection: string; // Be more specific;
69
+ data: {
70
+ id: string;
71
+ name: string;
72
+ version: string;
73
+ };
74
+ }>;
75
+ // ---------------------------------------------------------------------------
76
+ // Messages
77
+ producers?: Array<{
78
+ collection: string; // Specify only 'services'?
79
+ data: {
80
+ id: string;
81
+ name: string;
82
+ version: string;
83
+ };
84
+ }>;
85
+ // Only for messages
86
+ consumers?: Array<{
87
+ collection: string; // Specify only 'services'?
88
+ data: {
89
+ id: string;
90
+ name: string;
91
+ version: string;
92
+ };
93
+ }>;
94
+ // ---------------------------------------------------------------------------
95
+ };
96
+ };
97
+
98
+ export const Table = <T extends TCollectionTypes>({
33
99
  data: initialData,
34
100
  collection,
35
101
  mode = 'simple',
36
102
  checkboxLatestId,
37
103
  }: {
38
- data: CollectionEntry<'events'>[];
39
- collection: string;
104
+ data: TData<T>[];
105
+ collection: T;
40
106
  checkboxLatestId: string;
41
107
  mode?: 'simple' | 'full';
42
108
  }) => {
@@ -68,7 +134,6 @@ export const Table = ({
68
134
  const columns = useMemo(() => getColumnsByCollection(collection), [collection]);
69
135
 
70
136
  const table = useReactTable({
71
- // @ts-ignore
72
137
  data,
73
138
  columns,
74
139
  onColumnFiltersChange: setColumnFilters,
@@ -106,7 +171,6 @@ export const Table = ({
106
171
  <div className="text-md">
107
172
  {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
108
173
  </div>
109
- {/* @ts-ignore */}
110
174
  <div className="">
111
175
  {header.column.columnDef.meta?.showFilter !== false && <Filter column={header.column} />}
112
176
  {header.column.columnDef.meta?.showFilter == false && <div className="h-10" />}
@@ -201,23 +265,17 @@ export const Table = ({
201
265
  );
202
266
  };
203
267
 
204
- function Filter({ column }: { column: Column<any, unknown> }) {
205
- const { filterVariant, collectionFilterKey = '' } = column.columnDef.meta ?? {};
268
+ function Filter<T extends TCollectionTypes>({ column }: { column: Column<TData<T>, unknown> }) {
269
+ const { filterVariant, collectionFilterKey } = column.columnDef.meta ?? {};
206
270
 
207
271
  const columnFilterValue = column.getFilterValue();
208
272
 
209
273
  const sortedUniqueValues = useMemo(() => {
210
- if (filterVariant === 'collection') {
274
+ if (filterVariant === 'collection' && collectionFilterKey) {
211
275
  const rows = column.getFacetedRowModel().rows;
212
- const data = rows
213
- .map((row: Row<CollectionEntry<CollectionTypes>>) => {
214
- // @ts-ignore
215
- const items = row.original.data[collectionFilterKey];
216
- return items as CollectionEntry<CollectionTypes>[];
217
- })
218
- .flat();
276
+ const data = rows.map((row) => row.original.data?.[collectionFilterKey] ?? []).flat();
219
277
 
220
- const allItems = data.map((item) => `${item.data.name} (v${item.data.version})`);
278
+ const allItems = data.map((item) => `${item?.data.name} (v${item?.data.version})`);
221
279
  const uniqueItemsInList = Array.from(new Set(allItems));
222
280
 
223
281
  return uniqueItemsInList.sort().slice(0, 2000);
@@ -225,10 +283,9 @@ function Filter({ column }: { column: Column<any, unknown> }) {
225
283
  if (filterVariant === 'name') {
226
284
  const rows = column.getFacetedRowModel().rows;
227
285
  const data = rows
228
- .map((row: Row<CollectionEntry<CollectionTypes>>) => {
229
- // @ts-ignore
286
+ .map((row) => {
230
287
  const data = row.original;
231
- return data as CollectionEntry<CollectionTypes>;
288
+ return data;
232
289
  })
233
290
  .flat();
234
291
 
@@ -1,13 +1,12 @@
1
1
  import { ServerIcon } from '@heroicons/react/20/solid';
2
2
  import { RectangleGroupIcon } from '@heroicons/react/20/solid';
3
3
  import { createColumnHelper } from '@tanstack/react-table';
4
- import type { CollectionEntry } from 'astro:content';
5
- import { filterByBadge, filterByName, filterCollectionByName } from '../filters/custom-filters';
4
+ import { filterByName, filterCollectionByName } from '../filters/custom-filters';
6
5
  import { buildUrl } from '@utils/url-builder';
7
- import { Tag } from 'lucide-react';
8
6
  import { createBadgesColumn } from './SharedColumns';
7
+ import type { TData } from '../Table';
9
8
 
10
- const columnHelper = createColumnHelper<CollectionEntry<'domains'>>();
9
+ const columnHelper = createColumnHelper<TData<'domains'>>();
11
10
 
12
11
  export const columns = () => [
13
12
  columnHelper.accessor('data.name', {
@@ -65,7 +64,7 @@ export const columns = () => [
65
64
 
66
65
  return (
67
66
  <ul>
68
- {services.map((consumer: any) => {
67
+ {services.map((consumer) => {
69
68
  const color = 'pink';
70
69
  return (
71
70
  <li key={consumer.data.id} className="py-1 group ">
@@ -1,11 +1,11 @@
1
1
  import { createColumnHelper } from '@tanstack/react-table';
2
- import type { CollectionEntry } from 'astro:content';
3
2
  import { filterByName } from '../filters/custom-filters';
4
3
  import { buildUrl } from '@utils/url-builder';
5
4
  import { QueueListIcon } from '@heroicons/react/24/solid';
6
5
  import { createBadgesColumn } from './SharedColumns';
6
+ import type { TData } from '../Table';
7
7
 
8
- const columnHelper = createColumnHelper<CollectionEntry<'flows'>>();
8
+ const columnHelper = createColumnHelper<TData<'flows'>>();
9
9
 
10
10
  export const columns = () => [
11
11
  columnHelper.accessor('data.name', {
@@ -1,13 +1,13 @@
1
1
  import { ServerIcon, BoltIcon, ChatBubbleLeftIcon, MagnifyingGlassIcon } from '@heroicons/react/24/solid';
2
2
  import { createColumnHelper } from '@tanstack/react-table';
3
- import type { CollectionMessageTypes } from '@types';
4
- import type { CollectionEntry } from 'astro:content';
5
3
  import { useMemo } from 'react';
6
- import { filterByName, filterCollectionByName, filterByBadge } from '../filters/custom-filters';
4
+ import { filterByName, filterCollectionByName } from '../filters/custom-filters';
7
5
  import { buildUrl } from '@utils/url-builder';
8
6
  import { createBadgesColumn } from './SharedColumns';
7
+ import type { TData } from '../Table';
8
+ import type { CollectionMessageTypes } from '@types';
9
9
 
10
- const columnHelper = createColumnHelper<CollectionEntry<CollectionMessageTypes>>();
10
+ const columnHelper = createColumnHelper<TData<CollectionMessageTypes>>();
11
11
 
12
12
  export const getColorAndIconForMessageType = (type: string) => {
13
13
  switch (type) {
@@ -80,7 +80,7 @@ export const columns = () => [
80
80
  return <div className="font-light text-sm text-gray-400/60 text-left italic">No producers documented</div>;
81
81
  return (
82
82
  <ul className="">
83
- {producers.map((producer: any, index: number) => {
83
+ {producers.map((producer, index) => {
84
84
  return (
85
85
  <li className="py-2 group flex items-center space-x-2" key={`${producer.data.id}-${index}`}>
86
86
  <a
@@ -120,7 +120,7 @@ export const columns = () => [
120
120
 
121
121
  return (
122
122
  <ul>
123
- {consumers.map((consumer: any, index: number) => {
123
+ {consumers.map((consumer, index) => {
124
124
  return (
125
125
  <li key={`${consumer.data.id}-${index}`} className="py-1 group font-light ">
126
126
  <a
@@ -1,13 +1,13 @@
1
1
  import { ServerIcon, BoltIcon, ChatBubbleLeftIcon } from '@heroicons/react/24/solid';
2
2
  import { createColumnHelper } from '@tanstack/react-table';
3
- import type { CollectionEntry } from 'astro:content';
4
3
  import { useMemo, useState } from 'react';
5
4
  import { filterByName, filterCollectionByName } from '../filters/custom-filters';
6
5
  import { buildUrl } from '@utils/url-builder';
7
6
  import { getColorAndIconForMessageType } from './MessageTableColumns';
8
7
  import { createBadgesColumn } from './SharedColumns';
8
+ import type { TData } from '../Table';
9
9
 
10
- const columnHelper = createColumnHelper<CollectionEntry<'services'>>();
10
+ const columnHelper = createColumnHelper<TData<'services'>>();
11
11
 
12
12
  export const columns = () => [
13
13
  columnHelper.accessor('data.name', {
@@ -65,7 +65,7 @@ export const columns = () => [
65
65
 
66
66
  const receiversWithIcons = useMemo(
67
67
  () =>
68
- receives?.map((consumer: any) => {
68
+ receives?.map((consumer) => {
69
69
  const type = consumer.collection.slice(0, -1);
70
70
  return {
71
71
  ...consumer,
@@ -87,7 +87,7 @@ export const columns = () => [
87
87
  )}
88
88
  {isExpanded && (
89
89
  <ul>
90
- {receiversWithIcons.map((consumer: any, index: number) => (
90
+ {receiversWithIcons.map((consumer, index: number) => (
91
91
  <li key={`${consumer.data.id}-${index}`} className="py-1 group font-light ">
92
92
  <a
93
93
  href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
@@ -137,7 +137,7 @@ export const columns = () => [
137
137
  )}
138
138
  {isExpanded && (
139
139
  <ul>
140
- {sends.map((consumer: any, index: number) => {
140
+ {sends.map((consumer, index) => {
141
141
  const type = consumer.collection.slice(0, -1);
142
142
  const color = type === 'event' ? 'orange' : 'blue';
143
143
  const Icon = type === 'event' ? BoltIcon : ChatBubbleLeftIcon;
@@ -1,7 +1,9 @@
1
1
  import { createColumnHelper } from '@tanstack/react-table';
2
2
  import { Tag } from 'lucide-react';
3
3
  import { filterByBadge } from '../filters/custom-filters';
4
- export const createBadgesColumn = <T extends { data: { badges?: any[] } }>(
4
+ import type { TCollectionTypes, TData } from '../Table';
5
+
6
+ export const createBadgesColumn = <T extends { data: Pick<TData<U>['data'], 'badges'> }, U extends TCollectionTypes>(
5
7
  columnHelper: ReturnType<typeof createColumnHelper<T>>
6
8
  ) => {
7
9
  return columnHelper.accessor((row) => row.data.badges, {
@@ -16,7 +18,7 @@ export const createBadgesColumn = <T extends { data: { badges?: any[] } }>(
16
18
 
17
19
  return (
18
20
  <ul>
19
- {badges.map((badge: any, index: number) => {
21
+ {badges.map((badge, index) => {
20
22
  return (
21
23
  <li key={`${badge.id}-${index}`} className="py-1 group font-light ">
22
24
  <div className="group-hover:text-primary flex space-x-1 items-center ">
@@ -1,5 +1,5 @@
1
1
  ---
2
- import { Table } from '@components/Tables/Table';
2
+ import { Table, type TData, type TCollectionTypes } from '@components/Tables/Table';
3
3
  import { QueueListIcon, RectangleGroupIcon, BoltIcon, ChatBubbleLeftIcon } from '@heroicons/react/24/outline';
4
4
  import ServerIcon from '@heroicons/react/24/outline/ServerIcon';
5
5
  import { getCommands } from '@utils/commands';
@@ -20,6 +20,13 @@ const services = await getServices();
20
20
  const domains = await getDomains();
21
21
  const flows = await getFlows();
22
22
 
23
+ export interface Props<T extends TCollectionTypes> {
24
+ title: string;
25
+ subtitle: string;
26
+ data: TData<T>[];
27
+ type: T;
28
+ }
29
+
23
30
  const { title, subtitle, data, type } = Astro.props;
24
31
  const currentPath = Astro.url.pathname;
25
32