@spectral_labs/ui 1.6.1 → 1.8.0-next.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.
Files changed (163) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD_PARTY_NOTICES.md +201 -0
  3. package/dist/components/command/command.svelte.d.ts +30 -0
  4. package/dist/components/command/command.svelte.d.ts.map +1 -1
  5. package/dist/components/command/command.svelte.js +85 -4
  6. package/dist/components/command/components/command-group.svelte +25 -15
  7. package/dist/components/command/components/command-group.svelte.d.ts.map +1 -1
  8. package/dist/components/command/components/command-input.svelte +54 -5
  9. package/dist/components/command/components/command-input.svelte.d.ts +1 -1
  10. package/dist/components/command/components/command-input.svelte.d.ts.map +1 -1
  11. package/dist/components/command/components/command-list.svelte +22 -3
  12. package/dist/components/command/components/command-list.svelte.d.ts.map +1 -1
  13. package/dist/components/command/components/command-root.svelte +43 -4
  14. package/dist/components/command/components/command-root.svelte.d.ts.map +1 -1
  15. package/dist/components/command/index.d.ts +1 -0
  16. package/dist/components/command/index.d.ts.map +1 -1
  17. package/dist/components/command/types.d.ts +59 -4
  18. package/dist/components/command/types.d.ts.map +1 -1
  19. package/package.json +8 -2
  20. package/dist/components/__tests__/overlay-scrim-source.test.js +0 -134
  21. package/dist/components/accordion/__tests__/AccordionTest.svelte +0 -31
  22. package/dist/components/accordion/__tests__/accordion.test.svelte.js +0 -139
  23. package/dist/components/alert-dialog/__tests__/AlertDialogTest.svelte +0 -28
  24. package/dist/components/alert-dialog/__tests__/alert-dialog.a11y.test.js +0 -42
  25. package/dist/components/alert-dialog/__tests__/alert-dialog.integration.test.svelte.js +0 -51
  26. package/dist/components/alert-dialog/__tests__/alert-dialog.test.svelte.js +0 -113
  27. package/dist/components/app-bar/__tests__/app-bar.test.svelte.js +0 -30
  28. package/dist/components/aspect-ratio/__tests__/aspect-ratio.test.svelte.js +0 -22
  29. package/dist/components/avatar/__tests__/avatar.test.svelte.js +0 -26
  30. package/dist/components/badge/__tests__/badge.test.svelte.js +0 -30
  31. package/dist/components/bottom-sheet/__tests__/BottomSheetTest.svelte +0 -22
  32. package/dist/components/bottom-sheet/__tests__/bottom-sheet.test.svelte.js +0 -83
  33. package/dist/components/button/__tests__/button.test.svelte.js +0 -63
  34. package/dist/components/calendar/__tests__/CalendarTest.svelte +0 -56
  35. package/dist/components/calendar/__tests__/calendar.test.svelte.js +0 -190
  36. package/dist/components/card/__tests__/card.test.svelte.js +0 -30
  37. package/dist/components/checkbox/__tests__/checkbox.test.svelte.js +0 -44
  38. package/dist/components/chips/__tests__/chips.test.svelte.js +0 -26
  39. package/dist/components/collapsible/__tests__/CollapsibleTest.svelte +0 -18
  40. package/dist/components/collapsible/__tests__/collapsible.test.svelte.js +0 -125
  41. package/dist/components/combobox/__tests__/ComboboxTest.svelte +0 -40
  42. package/dist/components/combobox/__tests__/combobox.test.svelte.js +0 -255
  43. package/dist/components/command/__tests__/CommandTest.svelte +0 -77
  44. package/dist/components/command/__tests__/command-item-passthrough.test.svelte.js +0 -284
  45. package/dist/components/command/__tests__/command.a11y.test.js +0 -30
  46. package/dist/components/command/__tests__/command.integration.test.svelte.js +0 -68
  47. package/dist/components/command/__tests__/command.test.svelte.js +0 -230
  48. package/dist/components/context-menu/__tests__/ContextMenuNonInteractiveTest.svelte +0 -32
  49. package/dist/components/context-menu/__tests__/ContextMenuTest.svelte +0 -25
  50. package/dist/components/context-menu/__tests__/context-menu.test.svelte.js +0 -141
  51. package/dist/components/date-field/__tests__/DateFieldTest.svelte +0 -20
  52. package/dist/components/date-field/__tests__/date-field.test.svelte.js +0 -139
  53. package/dist/components/date-picker/__tests__/DatePickerTest.svelte +0 -20
  54. package/dist/components/date-picker/__tests__/date-picker.test.svelte.js +0 -190
  55. package/dist/components/date-range-field/__tests__/DateRangeFieldTest.svelte +0 -20
  56. package/dist/components/date-range-field/__tests__/date-range-field.test.svelte.js +0 -130
  57. package/dist/components/date-range-picker/__tests__/DateRangePickerTest.svelte +0 -18
  58. package/dist/components/date-range-picker/__tests__/date-range-picker.test.svelte.js +0 -156
  59. package/dist/components/dialog/__tests__/DialogTest.svelte +0 -34
  60. package/dist/components/dialog/__tests__/dialog.test.svelte.js +0 -184
  61. package/dist/components/drop-zone/__tests__/drop-zone.test.svelte.js +0 -26
  62. package/dist/components/dropdown-menu/__tests__/DropdownMenuRadioTest.svelte +0 -90
  63. package/dist/components/dropdown-menu/__tests__/DropdownMenuTest.svelte +0 -71
  64. package/dist/components/dropdown-menu/__tests__/dropdown-menu-radio-group.test.svelte.js +0 -306
  65. package/dist/components/dropdown-menu/__tests__/dropdown-menu.test.svelte.js +0 -567
  66. package/dist/components/empty-state/__tests__/empty-state.test.svelte.js +0 -26
  67. package/dist/components/fab/__tests__/fab.test.svelte.js +0 -30
  68. package/dist/components/field/__tests__/FieldTest.svelte +0 -26
  69. package/dist/components/field/__tests__/field.test.svelte.js +0 -74
  70. package/dist/components/grid-list/__tests__/GridListTest.svelte +0 -46
  71. package/dist/components/grid-list/__tests__/grid-list.test.svelte.js +0 -231
  72. package/dist/components/hover-card/__tests__/HoverCardTest.svelte +0 -30
  73. package/dist/components/hover-card/__tests__/hover-card.test.svelte.js +0 -236
  74. package/dist/components/indicator/__tests__/indicator.test.svelte.js +0 -30
  75. package/dist/components/input/__tests__/input.test.svelte.js +0 -67
  76. package/dist/components/label/__tests__/label.test.svelte.js +0 -22
  77. package/dist/components/language-select/__tests__/language-select.test.svelte.js +0 -199
  78. package/dist/components/language-select/__tests__/languages.test.js +0 -87
  79. package/dist/components/link-preview/__tests__/LinkPreviewTest.svelte +0 -37
  80. package/dist/components/link-preview/__tests__/link-preview.a11y.test.js +0 -28
  81. package/dist/components/link-preview/__tests__/link-preview.integration.test.svelte.js +0 -54
  82. package/dist/components/link-preview/__tests__/link-preview.test.svelte.js +0 -215
  83. package/dist/components/list/__tests__/list.test.svelte.js +0 -22
  84. package/dist/components/menubar/__tests__/MenubarTest.svelte +0 -52
  85. package/dist/components/menubar/__tests__/menubar.a11y.test.js +0 -28
  86. package/dist/components/menubar/__tests__/menubar.integration.test.svelte.js +0 -57
  87. package/dist/components/menubar/__tests__/menubar.test.svelte.js +0 -328
  88. package/dist/components/meter/__tests__/meter.test.svelte.js +0 -26
  89. package/dist/components/nav-bar/__tests__/nav-bar.test.svelte.js +0 -23
  90. package/dist/components/nav-drawer/__tests__/nav-drawer.test.svelte.js +0 -28
  91. package/dist/components/nav-rail/__tests__/nav-rail.test.svelte.js +0 -28
  92. package/dist/components/pagination/__tests__/pagination.test.svelte.js +0 -26
  93. package/dist/components/pin-input/__tests__/pin-input.test.svelte.js +0 -71
  94. package/dist/components/popover/__tests__/PopoverTest.svelte +0 -27
  95. package/dist/components/popover/__tests__/popover.test.svelte.js +0 -196
  96. package/dist/components/progress/__tests__/progress.test.svelte.js +0 -32
  97. package/dist/components/radio-group/__tests__/radio-group.test.svelte.js +0 -22
  98. package/dist/components/range-calendar/__tests__/RangeCalendarTest.svelte +0 -23
  99. package/dist/components/range-calendar/__tests__/range-calendar.test.svelte.js +0 -105
  100. package/dist/components/rating-group/__tests__/rating-group.test.svelte.js +0 -26
  101. package/dist/components/scroll-area/__tests__/scroll-area.test.svelte.js +0 -34
  102. package/dist/components/search-field/__tests__/SearchFieldTest.svelte +0 -34
  103. package/dist/components/search-field/__tests__/search-field.test.svelte.js +0 -118
  104. package/dist/components/select/__tests__/SelectLabelPersistenceTest.svelte +0 -31
  105. package/dist/components/select/__tests__/SelectTest.svelte +0 -33
  106. package/dist/components/select/__tests__/select.test.svelte.js +0 -221
  107. package/dist/components/separator/__tests__/separator.test.svelte.js +0 -39
  108. package/dist/components/sheet/__tests__/SheetTest.svelte +0 -34
  109. package/dist/components/sheet/__tests__/sheet.test.svelte.js +0 -193
  110. package/dist/components/side-sheet/__tests__/side-sheet.test.svelte.js +0 -138
  111. package/dist/components/sidebar/__tests__/SidebarFullTest.svelte +0 -45
  112. package/dist/components/sidebar/__tests__/SidebarTest.svelte +0 -9
  113. package/dist/components/sidebar/__tests__/sidebar.test.svelte.js +0 -186
  114. package/dist/components/simple-dialog/__tests__/SimpleDialogTest.svelte +0 -40
  115. package/dist/components/simple-dialog/__tests__/simple-dialog.test.svelte.js +0 -50
  116. package/dist/components/simple-tooltip/__tests__/SimpleTooltipTest.svelte +0 -19
  117. package/dist/components/simple-tooltip/__tests__/simple-tooltip.test.svelte.js +0 -61
  118. package/dist/components/slider/__tests__/slider.test.svelte.js +0 -42
  119. package/dist/components/sortable-list/__tests__/NestedSortableListTest.svelte +0 -49
  120. package/dist/components/sortable-list/__tests__/SortableListTest.svelte +0 -42
  121. package/dist/components/sortable-list/__tests__/sortable-list.nested.test.svelte.js +0 -112
  122. package/dist/components/sortable-list/__tests__/sortable-list.test.svelte.js +0 -175
  123. package/dist/components/splitter/__tests__/splitter.test.svelte.js +0 -26
  124. package/dist/components/switch/__tests__/switch.test.svelte.js +0 -44
  125. package/dist/components/table/__tests__/table.test.svelte.js +0 -22
  126. package/dist/components/tabs/__tests__/TabsTest.svelte +0 -32
  127. package/dist/components/tabs/__tests__/tabs.test.svelte.js +0 -227
  128. package/dist/components/textarea/__tests__/textarea.test.svelte.js +0 -55
  129. package/dist/components/time-field/__tests__/TimeFieldTest.svelte +0 -20
  130. package/dist/components/time-field/__tests__/time-field.test.svelte.js +0 -100
  131. package/dist/components/time-range-field/__tests__/TimeRangeFieldTest.svelte +0 -20
  132. package/dist/components/time-range-field/__tests__/time-range-field.test.svelte.js +0 -124
  133. package/dist/components/toast/__tests__/toast.test.svelte.js +0 -46
  134. package/dist/components/toggle/__tests__/toggle.test.svelte.js +0 -38
  135. package/dist/components/toggle-group/__tests__/toggle-group.test.svelte.js +0 -22
  136. package/dist/components/toolbar/__tests__/ToolbarCompositionTest.svelte +0 -18
  137. package/dist/components/toolbar/__tests__/ToolbarTabstopTest.svelte +0 -10
  138. package/dist/components/toolbar/__tests__/toolbar.test.svelte.js +0 -63
  139. package/dist/components/tooltip/__tests__/TooltipTest.svelte +0 -22
  140. package/dist/components/tooltip/__tests__/tooltip.test.svelte.js +0 -225
  141. package/dist/components/tree/__tests__/TreeLabelContentTest.svelte +0 -21
  142. package/dist/components/tree/__tests__/TreeTest.svelte +0 -24
  143. package/dist/components/tree/__tests__/tree.test.svelte.js +0 -229
  144. package/dist/components/virtualizer/__tests__/waterfall-layout.test.js +0 -82
  145. package/dist/internal/announcer/__tests__/announcer.test.js +0 -42
  146. package/dist/internal/dismissible-layer/__tests__/dismissible-layer.test.js +0 -196
  147. package/dist/internal/drag-drop/__tests__/auto-scroll.test.js +0 -104
  148. package/dist/internal/drag-drop/__tests__/drag-session.test.svelte.js +0 -803
  149. package/dist/internal/drag-drop/__tests__/drag-source.test.svelte.js +0 -130
  150. package/dist/internal/drag-drop/__tests__/drop-delegate.test.js +0 -223
  151. package/dist/internal/drag-drop/__tests__/types.test.js +0 -20
  152. package/dist/internal/escape-layer/__tests__/escape-layer.test.js +0 -113
  153. package/dist/internal/focus-scope/__tests__/focus-scope.test.js +0 -225
  154. package/dist/internal/grace-area/__tests__/grace-area.test.js +0 -67
  155. package/dist/internal/helpers/__tests__/helpers.test.js +0 -123
  156. package/dist/internal/portal/__tests__/PortalTest.svelte +0 -21
  157. package/dist/internal/portal/__tests__/portal.test.js +0 -29
  158. package/dist/internal/portal/__tests__/portal.test.svelte.js +0 -57
  159. package/dist/internal/scroll-lock/__tests__/scroll-lock.test.js +0 -160
  160. package/dist/internal/typeahead/__tests__/typeahead.test.js +0 -61
  161. package/src/themes/__tests__/carbon-dark-contrast.test.ts +0 -170
  162. package/src/themes/__tests__/generated-css-drift.test.ts +0 -53
  163. package/src/themes/__tests__/scrim-opaque.test.ts +0 -52
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Spectral
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,201 @@
1
+ # Third-party notices
2
+
3
+ `@spectral_labs/ui` is released under the MIT licence (`LICENSE`). It also ships the third-party material below, which keeps its own licence: one section per item, its licence reproduced as is.
4
+
5
+ ## Inter (OFL-1.1)
6
+
7
+ Inter 4.001, the variable font files `src/fonts/inter/InterVariable.woff2` and `src/fonts/inter/InterVariable-Italic.woff2` (https://github.com/rsms/inter). The copyright line is the one the font files carry.
8
+
9
+ ```text
10
+ Copyright 2016 The Inter Project Authors
11
+
12
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
13
+ This license is copied below, and is also available with a FAQ at:
14
+ http://scripts.sil.org/OFL
15
+
16
+ -----------------------------------------------------------
17
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
18
+ -----------------------------------------------------------
19
+
20
+ PREAMBLE
21
+ The goals of the Open Font License (OFL) are to stimulate worldwide
22
+ development of collaborative font projects, to support the font creation
23
+ efforts of academic and linguistic communities, and to provide a free and
24
+ open framework in which fonts may be shared and improved in partnership
25
+ with others.
26
+
27
+ The OFL allows the licensed fonts to be used, studied, modified and
28
+ redistributed freely as long as they are not sold by themselves. The
29
+ fonts, including any derivative works, can be bundled, embedded,
30
+ redistributed and/or sold with any software provided that any reserved
31
+ names are not used by derivative works. The fonts and derivatives,
32
+ however, cannot be released under any other type of license. The
33
+ requirement for fonts to remain under this license does not apply
34
+ to any document created using the fonts or their derivatives.
35
+
36
+ DEFINITIONS
37
+ "Font Software" refers to the set of files released by the Copyright
38
+ Holder(s) under this license and clearly marked as such. This may
39
+ include source files, build scripts and documentation.
40
+
41
+ "Reserved Font Name" refers to any names specified as such after the
42
+ copyright statement(s).
43
+
44
+ "Original Version" refers to the collection of Font Software components as
45
+ distributed by the Copyright Holder(s).
46
+
47
+ "Modified Version" refers to any derivative made by adding to, deleting,
48
+ or substituting -- in part or in whole -- any of the components of the
49
+ Original Version, by changing formats or by porting the Font Software to a
50
+ new environment.
51
+
52
+ "Author" refers to any designer, engineer, programmer, technical
53
+ writer or other person who contributed to the Font Software.
54
+
55
+ PERMISSION & CONDITIONS
56
+ Permission is hereby granted, free of charge, to any person obtaining
57
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
58
+ redistribute, and sell modified and unmodified copies of the Font
59
+ Software, subject to the following conditions:
60
+
61
+ 1) Neither the Font Software nor any of its individual components,
62
+ in Original or Modified Versions, may be sold by itself.
63
+
64
+ 2) Original or Modified Versions of the Font Software may be bundled,
65
+ redistributed and/or sold with any software, provided that each copy
66
+ contains the above copyright notice and this license. These can be
67
+ included either as stand-alone text files, human-readable headers or
68
+ in the appropriate machine-readable metadata fields within text or
69
+ binary files as long as those fields can be easily viewed by the user.
70
+
71
+ 3) No Modified Version of the Font Software may use the Reserved Font
72
+ Name(s) unless explicit written permission is granted by the corresponding
73
+ Copyright Holder. This restriction only applies to the primary font name as
74
+ presented to the users.
75
+
76
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
77
+ Software shall not be used to promote, endorse or advertise any
78
+ Modified Version, except to acknowledge the contribution(s) of the
79
+ Copyright Holder(s) and the Author(s) or with their explicit written
80
+ permission.
81
+
82
+ 5) The Font Software, modified or unmodified, in part or in whole,
83
+ must be distributed entirely under this license, and must not be
84
+ distributed under any other license. The requirement for fonts to
85
+ remain under this license does not apply to any document created
86
+ using the Font Software.
87
+
88
+ TERMINATION
89
+ This license becomes null and void if any of the above conditions are
90
+ not met.
91
+
92
+ DISCLAIMER
93
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
101
+ OTHER DEALINGS IN THE FONT SOFTWARE.
102
+ ```
103
+
104
+ ## JetBrains Mono (OFL-1.1)
105
+
106
+ JetBrains Mono 2.304, the font files `src/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2`, `src/fonts/jetbrains-mono/JetBrainsMono-Bold.woff2` and `src/fonts/jetbrains-mono/JetBrainsMono-Italic.woff2` (https://github.com/JetBrains/JetBrainsMono). The copyright line is the one the font files carry.
107
+
108
+ ```text
109
+ Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
110
+
111
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
112
+ This license is copied below, and is also available with a FAQ at:
113
+ https://scripts.sil.org/OFL
114
+
115
+ -----------------------------------------------------------
116
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
117
+ -----------------------------------------------------------
118
+
119
+ PREAMBLE
120
+ The goals of the Open Font License (OFL) are to stimulate worldwide
121
+ development of collaborative font projects, to support the font creation
122
+ efforts of academic and linguistic communities, and to provide a free and
123
+ open framework in which fonts may be shared and improved in partnership
124
+ with others.
125
+
126
+ The OFL allows the licensed fonts to be used, studied, modified and
127
+ redistributed freely as long as they are not sold by themselves. The
128
+ fonts, including any derivative works, can be bundled, embedded,
129
+ redistributed and/or sold with any software provided that any reserved
130
+ names are not used by derivative works. The fonts and derivatives,
131
+ however, cannot be released under any other type of license. The
132
+ requirement for fonts to remain under this license does not apply
133
+ to any document created using the fonts or their derivatives.
134
+
135
+ DEFINITIONS
136
+ "Font Software" refers to the set of files released by the Copyright
137
+ Holder(s) under this license and clearly marked as such. This may
138
+ include source files, build scripts and documentation.
139
+
140
+ "Reserved Font Name" refers to any names specified as such after the
141
+ copyright statement(s).
142
+
143
+ "Original Version" refers to the collection of Font Software components as
144
+ distributed by the Copyright Holder(s).
145
+
146
+ "Modified Version" refers to any derivative made by adding to, deleting,
147
+ or substituting -- in part or in whole -- any of the components of the
148
+ Original Version, by changing formats or by porting the Font Software to a
149
+ new environment.
150
+
151
+ "Author" refers to any designer, engineer, programmer, technical
152
+ writer or other person who contributed to the Font Software.
153
+
154
+ PERMISSION & CONDITIONS
155
+ Permission is hereby granted, free of charge, to any person obtaining
156
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
157
+ redistribute, and sell modified and unmodified copies of the Font
158
+ Software, subject to the following conditions:
159
+
160
+ 1) Neither the Font Software nor any of its individual components,
161
+ in Original or Modified Versions, may be sold by itself.
162
+
163
+ 2) Original or Modified Versions of the Font Software may be bundled,
164
+ redistributed and/or sold with any software, provided that each copy
165
+ contains the above copyright notice and this license. These can be
166
+ included either as stand-alone text files, human-readable headers or
167
+ in the appropriate machine-readable metadata fields within text or
168
+ binary files as long as those fields can be easily viewed by the user.
169
+
170
+ 3) No Modified Version of the Font Software may use the Reserved Font
171
+ Name(s) unless explicit written permission is granted by the corresponding
172
+ Copyright Holder. This restriction only applies to the primary font name as
173
+ presented to the users.
174
+
175
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
176
+ Software shall not be used to promote, endorse or advertise any
177
+ Modified Version, except to acknowledge the contribution(s) of the
178
+ Copyright Holder(s) and the Author(s) or with their explicit written
179
+ permission.
180
+
181
+ 5) The Font Software, modified or unmodified, in part or in whole,
182
+ must be distributed entirely under this license, and must not be
183
+ distributed under any other license. The requirement for fonts to
184
+ remain under this license does not apply to any document created
185
+ using the Font Software.
186
+
187
+ TERMINATION
188
+ This license becomes null and void if any of the above conditions are
189
+ not met.
190
+
191
+ DISCLAIMER
192
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
193
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
194
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
195
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
196
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
197
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
198
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
199
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
200
+ OTHER DEALINGS IN THE FONT SOFTWARE.
201
+ ```
@@ -4,6 +4,14 @@
4
4
  * Manages search filtering, item scoring, keyboard navigation,
5
5
  * and selection for a command palette interface.
6
6
  */
7
+ /**
8
+ * `'modal'` — the shipped behaviour: the Root exists only while open, and
9
+ * closing unmounts everything, layers included.
10
+ * `'inline'` — the Root and its field stay mounted; `open` then governs only
11
+ * whether the RESULTS are rendered, and the Escape / outside-pointer layers
12
+ * follow the results, never the field.
13
+ */
14
+ export type CommandMode = 'modal' | 'inline';
7
15
  export interface CommandItem {
8
16
  id: string;
9
17
  value: string;
@@ -18,6 +26,25 @@ export interface CommandState {
18
26
  listId: string;
19
27
  shouldFilter: boolean;
20
28
  loop: boolean;
29
+ /** Composition mode of the owning Root. */
30
+ mode: CommandMode;
31
+ /** Whether the Root currently considers the palette open. */
32
+ open: boolean;
33
+ /** Whether a `Command.List` is actually rendered right now. */
34
+ listMounted: boolean;
35
+ /** Called by `Command.List` to report its own mount/unmount. */
36
+ setListMounted: (mounted: boolean) => void;
37
+ /**
38
+ * DOM id of the option that is BOTH active and rendered, or `null`.
39
+ *
40
+ * Resolved against the live registry — never from the stored selection
41
+ * alone — so it cannot outlive the option it names: filtering it out,
42
+ * unmounting the list, or removing the option all make it `null` on the
43
+ * spot. This is what `aria-activedescendant` reads.
44
+ */
45
+ getActiveOptionId: () => string | null;
46
+ /** Asks the Root to open. No-op when it is already open. */
47
+ requestOpen: () => void;
21
48
  setSearch: (query: string) => void;
22
49
  getScore: (value: string) => number;
23
50
  filter: (value: string, search: string, keywords?: string[]) => number;
@@ -47,7 +74,10 @@ export declare function createCommandState(options: {
47
74
  filter: (value: string, search: string, keywords?: string[]) => number;
48
75
  shouldFilter: boolean;
49
76
  loop: boolean;
77
+ mode: CommandMode;
78
+ open: boolean;
50
79
  onSearchChange?: (search: string) => void;
80
+ onRequestOpen?: () => void;
51
81
  }): CommandState;
52
82
  export declare function setCommandContext(state: CommandState): void;
53
83
  export declare function getCommandContext(): CommandState;
@@ -1 +1 @@
1
- {"version":3,"file":"command.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/command/command.svelte.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,M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CAAA;IACzC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;CAC3B,GAAG,YAAY,CA6Mf;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAE3D;AAED,wBAAgB,iBAAiB,IAAI,YAAY,CAEhD"}
@@ -4,7 +4,7 @@
4
4
  * Manages search filtering, item scoring, keyboard navigation,
5
5
  * and selection for a command palette interface.
6
6
  */
7
- import { getContext, setContext } from 'svelte';
7
+ import { getContext, setContext, untrack } from 'svelte';
8
8
  import { useId } from '../../internal/helpers/index.js';
9
9
  const KEY = Symbol('sp-command');
10
10
  /**
@@ -76,7 +76,45 @@ export function createCommandState(options) {
76
76
  // eslint-disable-next-line svelte/prefer-svelte-reactivity -- internal non-reactive scoring cache
77
77
  const scores = new Map();
78
78
  let selectedValue = $state('');
79
+ let listMounted = $state(false);
80
+ /**
81
+ * `items` and `scores` are deliberately PLAIN (a hot scoring cache). Anything
82
+ * derived from the COLLECTION therefore needs an explicit reactive beat, or
83
+ * removing an option would leave `aria-activedescendant` naming a node that
84
+ * no longer exists — silently, because no signal changed.
85
+ */
86
+ let collectionVersion = $state(0);
87
+ /**
88
+ * `registerItem` / `unregisterItem` run from an item's `$effect`. A plain
89
+ * `collectionVersion += 1` there is a read-modify-WRITE of reactive state, so
90
+ * the effect would take a dependency on the very signal it bumps and loop
91
+ * forever. The read is untracked; only the write is observable.
92
+ */
93
+ function bumpCollection() {
94
+ collectionVersion = untrack(() => collectionVersion) + 1;
95
+ }
96
+ /**
97
+ * The selection as the user actually sees it.
98
+ *
99
+ * The stored `selectedValue` survives unregistration (an option removed by
100
+ * the consumer, or the whole list unmounted while an inline field stays put).
101
+ * Reading it raw would hand out a selection that no rendered option carries —
102
+ * a stale highlight, a dead ARIA reference, and a first arrow press spent
103
+ * recovering instead of moving. Resolving against the live enabled+visible
104
+ * set makes all three impossible by construction, whatever order mounts and
105
+ * unmounts happen to interleave in during a remount.
106
+ */
107
+ function resolveSelected() {
108
+ void collectionVersion;
109
+ const enabled = getEnabledVisibleItems();
110
+ if (enabled.length === 0)
111
+ return '';
112
+ if (enabled.some((item) => item.value === selectedValue))
113
+ return selectedValue;
114
+ return enabled[0].value;
115
+ }
79
116
  function updateScores(search) {
117
+ bumpCollection();
80
118
  scores.clear();
81
119
  if (!options.shouldFilter || search === '') {
82
120
  for (const item of items)
@@ -89,6 +127,7 @@ export function createCommandState(options) {
89
127
  }
90
128
  }
91
129
  function getVisibleItems() {
130
+ void collectionVersion;
92
131
  return items.filter((item) => (scores.get(item.value) ?? 0) > 0);
93
132
  }
94
133
  function getEnabledVisibleItems() {
@@ -106,7 +145,11 @@ export function createCommandState(options) {
106
145
  selectedValue = enabled[enabled.length - 1].value;
107
146
  return;
108
147
  }
109
- const currentIndex = enabled.findIndex((item) => item.value === selectedValue);
148
+ // Résolue, pas brute : après un remontage la valeur stockée peut ne
149
+ // correspondre à aucune option rendue, et la navigation repartirait alors
150
+ // du début au lieu de continuer depuis ce qui est mis en évidence.
151
+ const current = resolveSelected();
152
+ const currentIndex = enabled.findIndex((item) => item.value === current);
110
153
  if (direction === 'next') {
111
154
  if (currentIndex === -1 || currentIndex >= enabled.length - 1) {
112
155
  selectedValue = options.loop ? enabled[0].value : enabled[enabled.length - 1].value;
@@ -131,10 +174,39 @@ export function createCommandState(options) {
131
174
  return options.search;
132
175
  },
133
176
  get selectedValue() {
134
- return selectedValue;
177
+ return resolveSelected();
135
178
  },
136
179
  inputId,
137
180
  listId,
181
+ get mode() {
182
+ return options.mode;
183
+ },
184
+ get open() {
185
+ return options.open;
186
+ },
187
+ get listMounted() {
188
+ return listMounted;
189
+ },
190
+ setListMounted(mounted) {
191
+ listMounted = mounted;
192
+ },
193
+ getActiveOptionId() {
194
+ void collectionVersion;
195
+ // No list rendered ⇒ no option rendered ⇒ nothing to point at.
196
+ if (!listMounted)
197
+ return null;
198
+ const active = resolveSelected();
199
+ if (active === '')
200
+ return null;
201
+ const item = getEnabledVisibleItems().find((candidate) => candidate.value === active);
202
+ // The DOM id of the rendered option, never its business `value`.
203
+ return item ? item.id : null;
204
+ },
205
+ requestOpen() {
206
+ if (options.open)
207
+ return;
208
+ options.onRequestOpen?.();
209
+ },
138
210
  get shouldFilter() {
139
211
  return options.shouldFilter;
140
212
  },
@@ -151,11 +223,19 @@ export function createCommandState(options) {
151
223
  }
152
224
  },
153
225
  getScore(value) {
226
+ // `scores` is a plain Map, so a reader that did not touch the collection
227
+ // beat would never see a score written AFTER it first ran. That is the
228
+ // case on every mount: an item's `isVisible` derived evaluates during
229
+ // render, while `registerItem` runs in its `$effect`, i.e. later. With a
230
+ // retained query the item scored 0 at render, matched at registration,
231
+ // and stayed hidden forever — no signal had changed.
232
+ void collectionVersion;
154
233
  return scores.get(value) ?? 0;
155
234
  },
156
235
  filter: options.filter,
157
236
  registerItem(item) {
158
237
  items.push(item);
238
+ bumpCollection();
159
239
  const score = options.shouldFilter && options.search
160
240
  ? options.filter(item.value, options.search, item.keywords)
161
241
  : 1;
@@ -171,13 +251,14 @@ export function createCommandState(options) {
171
251
  const item = items[index];
172
252
  scores.delete(item.value);
173
253
  items.splice(index, 1);
254
+ bumpCollection();
174
255
  }
175
256
  },
176
257
  select(value) {
177
258
  selectedValue = value;
178
259
  },
179
260
  getSelectedValue() {
180
- return selectedValue;
261
+ return resolveSelected();
181
262
  },
182
263
  navigateItems,
183
264
  selectCurrent() {
@@ -7,26 +7,36 @@
7
7
  const ctx = getCommandContext()
8
8
  const headingId = useId('sp-command-group')
9
9
 
10
- // In filtered mode, groups are hidden if they have no visible items
11
- // For simplicity, we always render and let CSS/items handle visibility
10
+ // In filtered mode, a group with no visible item is hidden — its heading
11
+ // alone would be a promise of results that are not there.
12
12
  const isHidden = $derived(
13
13
  !forceMount && ctx.shouldFilter && ctx.search !== '' && !ctx.hasVisibleItems(),
14
14
  )
15
15
  </script>
16
16
 
17
- {#if !isHidden}
18
- <div
19
- class="sp-command-group {className ?? ''}"
20
- role="group"
21
- aria-labelledby={heading ? headingId : undefined}
22
- data-command-group
23
- >
24
- {#if heading}
25
- <div class="sp-command-group-heading" id={headingId}>{heading}</div>
26
- {/if}
27
- {#if children}{@render children()}{/if}
28
- </div>
29
- {/if}
17
+ <!--
18
+ The group is HIDDEN, never unmounted. Items register from their own
19
+ `$effect`, so they must exist for the registry to learn about them: gating
20
+ the children on `hasVisibleItems()` — a predicate over that same registry —
21
+ deadlocked whenever the registry was empty while a query was retained. On
22
+ remount (an inline field whose list reopens, a list rebuilt after its options
23
+ changed) nothing ever registered again and the palette showed zero options,
24
+ permanently. Items already gate their OWN rendering on their score, so a
25
+ hidden group is an empty box: `hidden` takes it out of layout and out of the
26
+ accessibility tree, which is all the rule was ever asking for.
27
+ -->
28
+ <div
29
+ class="sp-command-group {className ?? ''}"
30
+ role="group"
31
+ aria-labelledby={heading ? headingId : undefined}
32
+ data-command-group
33
+ hidden={isHidden}
34
+ >
35
+ {#if heading}
36
+ <div class="sp-command-group-heading" id={headingId}>{heading}</div>
37
+ {/if}
38
+ {#if children}{@render children()}{/if}
39
+ </div>
30
40
 
31
41
  <style>
32
42
  .sp-command-group {
@@ -1 +1 @@
1
- {"version":3,"file":"command-group.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-group.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAiCpD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"command-group.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-group.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAgCpD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -3,12 +3,55 @@
3
3
  import { kbd } from '../../../internal/helpers/index.js'
4
4
  import { getCommandContext } from '../command.svelte.js'
5
5
 
6
- const { placeholder = 'Search...', class: className }: CommandInputProps = $props()
6
+ let {
7
+ placeholder = 'Search...',
8
+ class: className,
9
+ wrapperClass,
10
+ element = $bindable(null),
11
+ // Pulled out of `rest` so the built-in behaviour can COMPOSE with it
12
+ // instead of being clobbered by the spread.
13
+ onkeydown: consumerKeydown,
14
+ ...rest
15
+ }: CommandInputProps = $props()
7
16
  const ctx = getCommandContext()
8
17
 
9
- function onkeydown(e: KeyboardEvent) {
18
+ /**
19
+ * Every keyboard behaviour below is gated on the list being REALLY rendered,
20
+ * never on finding a node in the document. In `modal` the list is always
21
+ * rendered alongside the input, so this is constantly true and nothing about
22
+ * the shipped behaviour moves. In `inline` the field outlives the results,
23
+ * and that is where the distinction earns its keep.
24
+ */
25
+ const open = $derived(ctx.listMounted)
26
+
27
+ /** The rendered option's DOM id, or nothing at all. Resolved through the live
28
+ * registry, so it cannot name an option that filtering, removal or a closed
29
+ * list has taken away. */
30
+ const activeOptionId = $derived(ctx.getActiveOptionId() ?? undefined)
31
+
32
+ function onkeydown(e: KeyboardEvent & { currentTarget: EventTarget & HTMLInputElement }) {
10
33
  if (e.isComposing) return
11
34
 
35
+ // The consumer runs first and may cancel Spectral's local handling for this
36
+ // key. It cannot retract a close the Escape layer has already performed:
37
+ // that one runs earlier, on `document`, in the capture phase —
38
+ // `onEscapeKeydown` on `Command.Root` is the hook for it.
39
+ consumerKeydown?.(e)
40
+ if (e.defaultPrevented) return
41
+
42
+ if (!open) {
43
+ // Results closed. The field is an ordinary text input: Enter belongs to
44
+ // the surrounding form, Escape to whatever surface is actually listening,
45
+ // Home/End to the caret. Claiming them here would make a closed palette
46
+ // interfere with the page — and Enter, in particular, could activate an
47
+ // option nobody can see.
48
+ if (e.key === kbd.ARROW_DOWN || e.key === kbd.ARROW_UP) {
49
+ e.preventDefault()
50
+ ctx.requestOpen()
51
+ }
52
+ return
53
+ }
54
+
12
55
  switch (e.key) {
13
56
  case kbd.ARROW_DOWN: {
14
57
  e.preventDefault()
@@ -54,7 +97,7 @@
54
97
  }
55
98
  </script>
56
99
 
57
- <div class="sp-command-input-wrapper">
100
+ <div class="sp-command-input-wrapper {wrapperClass ?? ''}">
58
101
  <svg
59
102
  class="sp-command-input-icon"
60
103
  xmlns="http://www.w3.org/2000/svg"
@@ -71,13 +114,19 @@
71
114
  <circle cx="11" cy="11" r="8" />
72
115
  <path d="m21 21-4.3-4.3" />
73
116
  </svg>
117
+ <!-- `{...rest}` FIRST: a consumer may add attributes, never override the
118
+ field's identity (role, id, type) or the three relations computed from
119
+ the palette's own state — those come after and win. -->
74
120
  <input
121
+ {...rest}
122
+ bind:this={element}
75
123
  class="sp-command-input {className ?? ''}"
76
124
  id={ctx.inputId}
77
125
  type="text"
78
126
  role="combobox"
79
- aria-expanded="true"
80
- aria-controls={ctx.listId}
127
+ aria-expanded={ctx.open}
128
+ aria-controls={open ? ctx.listId : undefined}
129
+ aria-activedescendant={activeOptionId}
81
130
  aria-autocomplete="list"
82
131
  autocomplete="off"
83
132
  {placeholder}
@@ -1,5 +1,5 @@
1
1
  import type { CommandInputProps } from '../types.js';
2
- declare const CommandInput: import("svelte").Component<CommandInputProps, {}, "">;
2
+ declare const CommandInput: import("svelte").Component<CommandInputProps, {}, "element">;
3
3
  type CommandInput = ReturnType<typeof CommandInput>;
4
4
  export default CommandInput;
5
5
  //# sourceMappingURL=command-input.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-input.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-input.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAwEpD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"command-input.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-input.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAoHpD,QAAA,MAAM,YAAY,8DAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -4,11 +4,30 @@
4
4
 
5
5
  const { label = 'Suggestions', class: className, children }: CommandListProps = $props()
6
6
  const ctx = getCommandContext()
7
+
8
+ /**
9
+ * In `modal` the Root only exists while open, so this is always true and
10
+ * nothing changes. In `inline` the field outlives the results: the list must
11
+ * be ABSENT when closed, not merely hidden. Hiding it in CSS would leave
12
+ * every option in the document, where the Enter path could still reach one —
13
+ * an invisible command, executed.
14
+ */
15
+ const rendered = $derived(ctx.mode !== 'inline' || ctx.open)
16
+
17
+ // The Root gates behaviour on the list being REALLY rendered, so the list is
18
+ // what reports it rather than anyone inferring it.
19
+ $effect(() => {
20
+ if (!rendered) return
21
+ ctx.setListMounted(true)
22
+ return () => ctx.setListMounted(false)
23
+ })
7
24
  </script>
8
25
 
9
- <div class="sp-command-list {className ?? ''}" id={ctx.listId} role="listbox" aria-label={label}>
10
- {#if children}{@render children()}{/if}
11
- </div>
26
+ {#if rendered}
27
+ <div class="sp-command-list {className ?? ''}" id={ctx.listId} role="listbox" aria-label={label}>
28
+ {#if children}{@render children()}{/if}
29
+ </div>
30
+ {/if}
12
31
 
13
32
  <style>
14
33
  .sp-command-list {
@@ -1 +1 @@
1
- {"version":3,"file":"command-list.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-list.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAmBnD,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"command-list.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/command/components/command-list.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAsCnD,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}