Commit 40b589b
ref(cmdk) jsx powered cmdk (#112262)
Refactor CMDK to a composable JSX approach.
Previously, our CMDK required knowing actions aot and use a hook
registration process. We want to move to a fully JSX powered approach
and eventually also make actions render to the DOM (this is currently
not possible because virtualization is required and the listbox API
requires us to specify the full list)
This change brings us half way to being able to power the CMDK UI by
converting CMDK registration to JSX.
This enables some interesting patterns where the UI logic can be
colocated with the UI as seen
[here](0158ce5).
The way that this works is through the following mechanisms:
- Collection context responsible for storing nodes and edges
(essentially a recursive Context) that we use to maintain a
parent<->child mapping.
- A store with a `tree(root | undefined)` method which will reconstruct
the tree on-demand so that callers can have access to the most complete
UI at all times
The slots API mentioned above this are used in CMDK as contextual
priority slots that will appear as the first descendants of the CMDK
action (similar to how priority int value used to work before). CMDK now
has two slots, the first one is the `global` slot where global actions
should be registered, the second is the `page` where broader page
specific actions can be registered and the 3rd is the `task` slot, a
slot that is contextual to what the user is doing (e.g. if they are
editing a dashboard, saving or starring it might be a task they are
currently interested).
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>1 parent 24704ee commit 40b589b
File tree
23 files changed
+2211
-1369
lines changed- static/app
- bootstrap
- components
- commandPalette
- __stories__
- ui
- core
- compactSelect/listBox
- slot
- tests/js/sentry-test
23 files changed
+2211
-1369
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Lines changed: 26 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 12 | | |
20 | 13 | | |
21 | 14 | | |
22 | 15 | | |
23 | | - | |
| 16 | + | |
24 | 17 | | |
25 | 18 | | |
26 | 19 | | |
27 | 20 | | |
28 | | - | |
29 | | - | |
30 | 21 | | |
31 | 22 | | |
32 | 23 | | |
33 | 24 | | |
34 | 25 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 26 | | |
60 | 27 | | |
61 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
62 | 49 | | |
63 | 50 | | |
64 | 51 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 19 | + | |
39 | 20 | | |
40 | 21 | | |
41 | 22 | | |
42 | 23 | | |
43 | 24 | | |
44 | 25 | | |
45 | 26 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 27 | | |
51 | 28 | | |
52 | 29 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 30 | | |
67 | 31 | | |
68 | 32 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 33 | + | |
72 | 34 | | |
73 | 35 | | |
74 | 36 | | |
75 | 37 | | |
76 | 38 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
0 commit comments