@sveltia/ui 0.26.2 → 0.26.3

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 (33) hide show
  1. package/dist/components/button/button.svelte +37 -37
  2. package/dist/components/button/select-button-group.svelte +9 -9
  3. package/dist/components/button/split-button.svelte +4 -4
  4. package/dist/components/calendar/calendar.svelte +5 -7
  5. package/dist/components/checkbox/checkbox.svelte +8 -8
  6. package/dist/components/dialog/dialog.svelte +1 -2
  7. package/dist/components/disclosure/disclosure.svelte +2 -2
  8. package/dist/components/drawer/drawer.svelte +1 -2
  9. package/dist/components/grid/grid-body.svelte +2 -2
  10. package/dist/components/grid/grid.svelte +2 -4
  11. package/dist/components/listbox/listbox.svelte +8 -8
  12. package/dist/components/listbox/option.svelte +10 -11
  13. package/dist/components/menu/menu-item.svelte +4 -4
  14. package/dist/components/menu/menu.svelte +1 -1
  15. package/dist/components/radio/radio-group.svelte +3 -3
  16. package/dist/components/radio/radio.svelte +9 -8
  17. package/dist/components/select/combobox.svelte +26 -27
  18. package/dist/components/table/table-body.svelte +2 -2
  19. package/dist/components/table/table.svelte +2 -4
  20. package/dist/components/text-editor/lexical-root.svelte +16 -63
  21. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +2 -2
  22. package/dist/components/text-field/number-input.svelte +6 -6
  23. package/dist/components/text-field/password-input.svelte +1 -1
  24. package/dist/components/text-field/search-bar.svelte +4 -4
  25. package/dist/components/text-field/text-area.svelte +4 -9
  26. package/dist/components/text-field/text-input.svelte +4 -6
  27. package/dist/components/toast/toast.svelte +6 -6
  28. package/dist/components/toolbar/toolbar.svelte +4 -5
  29. package/dist/components/util/app-shell.svelte +10 -33
  30. package/dist/components/util/modal.svelte +20 -7
  31. package/dist/components/util/popup.svelte +1 -1
  32. package/dist/styles/core.scss +16 -36
  33. package/package.json +8 -8
@@ -194,7 +194,6 @@
194
194
  class="combobox"
195
195
  {anchor}
196
196
  {position}
197
- showBackdrop={true}
198
197
  touchOptimized={true}
199
198
  bind:open={isPopupOpen}
200
199
  onOpen={() => {
@@ -252,29 +251,6 @@
252
251
  position: relative;
253
252
  min-width: var(--sui-combobox-min-width, calc(var(--sui-option-height) * 5));
254
253
  }
255
- .combobox :global(.icon) {
256
- font-size: var(--sui-font-size-xx-large);
257
- opacity: 0.5;
258
- }
259
- .combobox > :global(.icon) {
260
- position: absolute;
261
- inset: 8px auto auto 8px;
262
- z-index: 1;
263
- }
264
- .combobox > :global(button) {
265
- position: absolute;
266
- inset: 0 0 auto auto;
267
- z-index: 1;
268
- margin: 0 !important;
269
- border-top-left-radius: 0;
270
- border-bottom-left-radius: 0;
271
- }
272
- .combobox:not(.editable) > :global(button) {
273
- background-color: transparent !important;
274
- }
275
- .combobox > :global(button[tabindex="-1"]) {
276
- pointer-events: none;
277
- }
278
254
  .combobox div[role=combobox] {
279
255
  display: flex;
280
256
  align-items: center;
@@ -297,7 +273,7 @@
297
273
  .combobox div[role=combobox]:not(.selected) {
298
274
  font-style: italic;
299
275
  }
300
- .combobox div[role=combobox]:hover, .combobox div[role=combobox]:focus {
276
+ .combobox div[role=combobox]:is(:hover, :focus) {
301
277
  background-color: var(--sui-hover-background-color);
302
278
  }
303
279
  .combobox div[role=combobox][aria-invalid=true] {
@@ -306,6 +282,29 @@
306
282
  .combobox div[role=combobox] .label {
307
283
  width: 100%;
308
284
  }
285
+ .combobox :global(.icon) {
286
+ font-size: var(--sui-font-size-xx-large);
287
+ opacity: 0.5;
288
+ }
289
+ .combobox > :global(.icon) {
290
+ position: absolute;
291
+ inset: 8px auto auto 8px;
292
+ z-index: 1;
293
+ }
294
+ .combobox > :global(button) {
295
+ position: absolute;
296
+ inset: 0 0 auto auto;
297
+ z-index: 1;
298
+ margin: 0 !important;
299
+ border-top-left-radius: 0;
300
+ border-bottom-left-radius: 0;
301
+ }
302
+ .combobox > :global(button[tabindex="-1"]) {
303
+ pointer-events: none;
304
+ }
305
+ .combobox :global(:not(.editable)) > :global(button) {
306
+ background-color: transparent !important;
307
+ }
309
308
  .combobox :global(.text-input) {
310
309
  margin: 0 !important;
311
310
  width: 100% !important;
@@ -314,7 +313,7 @@
314
313
  padding: 0 32px 0 8px;
315
314
  width: 0;
316
315
  }
317
- .combobox + :global([role="listbox"]) {
316
+ .combobox + :global([role=listbox]) {
318
317
  position: fixed;
319
318
  z-index: 100;
320
319
  border-radius: var(--sui-control-medium-border-radius);
@@ -326,7 +325,7 @@
326
325
  /* Add .1s delay before the position can be determined */
327
326
  transition: opacity 100ms 100ms;
328
327
  }
329
- .combobox + :global([role="listbox"]:not(.open)) {
328
+ .combobox + :global([role=listbox]:not(.open)) {
330
329
  opacity: 0;
331
330
  pointer-events: none;
332
331
  }
@@ -41,7 +41,7 @@
41
41
  {#if label}
42
42
  <div role="row" class="row-group-caption">
43
43
  <!-- We need `colspan` here but cannot place `<th>` under `<div>`, so use a hack -->
44
- <svelte:element this={'th'} role="rowheader" id="{id}-label" colspan="9999">
44
+ <svelte:element this={'th'} role="columnheader" id="{id}-label" colspan="9999">
45
45
  {label}
46
46
  </svelte:element>
47
47
  </div>
@@ -57,7 +57,7 @@
57
57
  display: table-row;
58
58
  }
59
59
 
60
- [role=rowheader] {
60
+ [role=columnheader] {
61
61
  display: table-cell;
62
62
  padding: 8px;
63
63
  color: var(--sui-secondary-foreground-color);
@@ -36,12 +36,10 @@
36
36
  margin: var(--sui-focus-ring-width);
37
37
  width: calc(100% - var(--sui-focus-ring-width) * 2);
38
38
  }
39
- .table:global(.data) {
39
+ .table.data {
40
40
  border-collapse: collapse;
41
41
  }
42
- .table:global(.data) :global(.table-col-header),
43
- .table:global(.data) :global(.table-row-header),
44
- .table:global(.data) :global(.table-cell) {
42
+ .table.data :global(:is(.table-col-header, .table-row-header, .table-cell)) {
45
43
  border: 1px solid var(--sui-secondary-border-color);
46
44
  padding: 8px 8px;
47
45
  }</style>
@@ -192,17 +192,13 @@
192
192
  .lexical-root :global([data-lexical-text=true]) {
193
193
  cursor: text;
194
194
  }
195
- .lexical-root :global(th) > :global(p),
196
- .lexical-root :global(td) > :global(p) {
195
+ .lexical-root :global(:is(th, td)) > :global(p) {
197
196
  margin: 0;
198
197
  white-space: normal;
199
198
  word-break: normal;
200
199
  }
201
200
 
202
- :root[data-theme=light] .lexical-root :global(.token.comment),
203
- :root[data-theme=light] .lexical-root :global(.token.prolog),
204
- :root[data-theme=light] .lexical-root :global(.token.doctype),
205
- :root[data-theme=light] .lexical-root :global(.token.cdata) {
201
+ :root[data-theme=light] .lexical-root :global(.token:is(.comment, .prolog, .doctype, .cdata)) {
206
202
  color: slategray;
207
203
  }
208
204
  :root[data-theme=light] .lexical-root :global(.token.punctuation) {
@@ -211,96 +207,53 @@
211
207
  :root[data-theme=light] .lexical-root :global(.token.namespace) {
212
208
  opacity: 0.7;
213
209
  }
214
- :root[data-theme=light] .lexical-root :global(.token.property),
215
- :root[data-theme=light] .lexical-root :global(.token.tag),
216
- :root[data-theme=light] .lexical-root :global(.token.boolean),
217
- :root[data-theme=light] .lexical-root :global(.token.number),
218
- :root[data-theme=light] .lexical-root :global(.token.constant),
219
- :root[data-theme=light] .lexical-root :global(.token.symbol),
220
- :root[data-theme=light] .lexical-root :global(.token.deleted) {
210
+ :root[data-theme=light] .lexical-root :global(.token:is(.property, .tag, .boolean, .number, .constant, .symbol, .deleted)) {
221
211
  color: #905;
222
212
  }
223
- :root[data-theme=light] .lexical-root :global(.token.selector),
224
- :root[data-theme=light] .lexical-root :global(.token.attr-name),
225
- :root[data-theme=light] .lexical-root :global(.token.string),
226
- :root[data-theme=light] .lexical-root :global(.token.char),
227
- :root[data-theme=light] .lexical-root :global(.token.builtin),
228
- :root[data-theme=light] .lexical-root :global(.token.inserted) {
213
+ :root[data-theme=light] .lexical-root :global(.token:is(.selector, .attr-name, .string, .char, .builtin, .inserted)) {
229
214
  color: #690;
230
215
  }
231
- :root[data-theme=light] .lexical-root :global(.token.operator),
232
- :root[data-theme=light] .lexical-root :global(.token.entity),
233
- :root[data-theme=light] .lexical-root :global(.token.url),
234
- :root[data-theme=light] .lexical-root :global(.language-css) :global(.token.string),
235
- :root[data-theme=light] .lexical-root :global(.style) :global(.token.string) {
216
+ :root[data-theme=light] .lexical-root :global(.token:is(.operator, .entity, .url)), :root[data-theme=light] .lexical-root :global(.language-css) :global(.token.string), :root[data-theme=light] .lexical-root :global(.style) :global(.token.string) {
236
217
  color: #9a6e3a;
237
218
  }
238
- :root[data-theme=light] .lexical-root :global(.token.atrule),
239
- :root[data-theme=light] .lexical-root :global(.token.attr-value),
240
- :root[data-theme=light] .lexical-root :global(.token.keyword) {
219
+ :root[data-theme=light] .lexical-root :global(.token:is(.atrule, .attr-value, .keyword)) {
241
220
  color: #07a;
242
221
  }
243
- :root[data-theme=light] .lexical-root :global(.token.function),
244
- :root[data-theme=light] .lexical-root :global(.token.class-name) {
222
+ :root[data-theme=light] .lexical-root :global(.token:is(.function, .class-name)) {
245
223
  color: #dd4a68;
246
224
  }
247
- :root[data-theme=light] .lexical-root :global(.token.regex),
248
- :root[data-theme=light] .lexical-root :global(.token.important),
249
- :root[data-theme=light] .lexical-root :global(.token.variable) {
225
+ :root[data-theme=light] .lexical-root :global(.token:is(.regex, .important, .variable)) {
250
226
  color: #e90;
251
227
  }
252
228
 
253
- :root[data-theme=dark] .lexical-root :global(.token.comment),
254
- :root[data-theme=dark] .lexical-root :global(.token.block-comment),
255
- :root[data-theme=dark] .lexical-root :global(.token.prolog),
256
- :root[data-theme=dark] .lexical-root :global(.token.doctype),
257
- :root[data-theme=dark] .lexical-root :global(.token.cdata) {
229
+ :root[data-theme=dark] .lexical-root :global(.token:is(.comment, .block-comment, .prolog, .doctype, .cdata)) {
258
230
  color: #999;
259
231
  }
260
232
  :root[data-theme=dark] .lexical-root :global(.token.punctuation) {
261
233
  color: #ccc;
262
234
  }
263
- :root[data-theme=dark] .lexical-root :global(.token.tag),
264
- :root[data-theme=dark] .lexical-root :global(.token.attr-name),
265
- :root[data-theme=dark] .lexical-root :global(.token.namespace),
266
- :root[data-theme=dark] .lexical-root :global(.token.deleted) {
235
+ :root[data-theme=dark] .lexical-root :global(.token:is(.tag, .attr-name, .namespace, .deleted)) {
267
236
  color: #e2777a;
268
237
  }
269
238
  :root[data-theme=dark] .lexical-root :global(.token.function-name) {
270
239
  color: #6196cc;
271
240
  }
272
- :root[data-theme=dark] .lexical-root :global(.token.boolean),
273
- :root[data-theme=dark] .lexical-root :global(.token.number),
274
- :root[data-theme=dark] .lexical-root :global(.token.function) {
241
+ :root[data-theme=dark] .lexical-root :global(.token:is(.boolean, .number, .function)) {
275
242
  color: #f08d49;
276
243
  }
277
- :root[data-theme=dark] .lexical-root :global(.token.property),
278
- :root[data-theme=dark] .lexical-root :global(.token.class-name),
279
- :root[data-theme=dark] .lexical-root :global(.token.constant),
280
- :root[data-theme=dark] .lexical-root :global(.token.symbol) {
244
+ :root[data-theme=dark] .lexical-root :global(.token:is(.property, .class-name, .constant, .symbol)) {
281
245
  color: #f8c555;
282
246
  }
283
- :root[data-theme=dark] .lexical-root :global(.token.selector),
284
- :root[data-theme=dark] .lexical-root :global(.token.important),
285
- :root[data-theme=dark] .lexical-root :global(.token.atrule),
286
- :root[data-theme=dark] .lexical-root :global(.token.keyword),
287
- :root[data-theme=dark] .lexical-root :global(.token.builtin) {
247
+ :root[data-theme=dark] .lexical-root :global(.token:is(.selector, .important, .atrule, .keyword, .builtin)) {
288
248
  color: #cc99cd;
289
249
  }
290
- :root[data-theme=dark] .lexical-root :global(.token.string),
291
- :root[data-theme=dark] .lexical-root :global(.token.char),
292
- :root[data-theme=dark] .lexical-root :global(.token.attr-value),
293
- :root[data-theme=dark] .lexical-root :global(.token.regex),
294
- :root[data-theme=dark] .lexical-root :global(.token.variable) {
250
+ :root[data-theme=dark] .lexical-root :global(.token:is(.string, .char, .attr-value, .regex, .variable)) {
295
251
  color: #7ec699;
296
252
  }
297
- :root[data-theme=dark] .lexical-root :global(.token.operator),
298
- :root[data-theme=dark] .lexical-root :global(.token.entity),
299
- :root[data-theme=dark] .lexical-root :global(.token.url) {
253
+ :root[data-theme=dark] .lexical-root :global(.token:is(.operator, .entity, .url)) {
300
254
  color: #67cdcc;
301
255
  }
302
- :root[data-theme=dark] .lexical-root :global(.token.important),
303
- :root[data-theme=dark] .lexical-root :global(.token.bold) {
256
+ :root[data-theme=dark] .lexical-root :global(.token:is(.important, .bold)) {
304
257
  font-weight: bold;
305
258
  }
306
259
  :root[data-theme=dark] .lexical-root :global(.token.italic) {
@@ -37,7 +37,7 @@
37
37
  <style>.wrapper {
38
38
  display: contents;
39
39
  }
40
- .wrapper :global([role="toolbar"]) {
40
+ .wrapper :global([role=toolbar]) {
41
41
  position: sticky;
42
42
  top: 0;
43
43
  z-index: 1;
@@ -51,7 +51,7 @@
51
51
  background-color: var(--sui-tertiary-background-color);
52
52
  }
53
53
  @media (width < 768px) {
54
- .wrapper :global([role="toolbar"]) {
54
+ .wrapper :global([role=toolbar]) {
55
55
  flex-wrap: wrap;
56
56
  height: auto;
57
57
  }
@@ -210,18 +210,18 @@
210
210
  width: stretch;
211
211
  min-width: 0;
212
212
  }
213
- .number-input :global(:not(:first-child) input) {
213
+ .number-input :global(:not(:first-child)) :global(input) {
214
214
  border-top-left-radius: 0;
215
215
  border-bottom-left-radius: 0;
216
216
  }
217
- .number-input :global(:not(:last-child) input) {
217
+ .number-input :global(:not(:last-child)) :global(input) {
218
218
  border-top-right-radius: 0;
219
219
  border-bottom-right-radius: 0;
220
220
  }
221
- .number-input:not(.disabled) :global(button[aria-disabled="true"]) {
221
+ .number-input :global(:not(.disabled)) :global(button[aria-disabled=true]) {
222
222
  filter: grayscale(0) opacity(1);
223
223
  }
224
- .number-input:not(.disabled) :global(button[aria-disabled="true"]) :global(*) {
224
+ .number-input :global(:not(.disabled)) :global(button[aria-disabled=true]) :global(*) {
225
225
  filter: grayscale(1) opacity(0.35);
226
226
  }
227
227
  .number-input :global(.text-input) {
@@ -245,13 +245,13 @@
245
245
  width: 100%;
246
246
  height: 50%;
247
247
  }
248
- .buttons :global(button):first-of-type {
248
+ .buttons :global(button:first-of-type) {
249
249
  border-top-right-radius: 0;
250
250
  border-bottom-right-radius: 0;
251
251
  border-bottom-left-radius: 0;
252
252
  border-width: 1px 0 0 1px;
253
253
  }
254
- .buttons :global(button):last-of-type {
254
+ .buttons :global(button:last-of-type) {
255
255
  border-top-left-radius: 0;
256
256
  border-top-right-radius: 0;
257
257
  border-bottom-right-radius: 0;
@@ -129,7 +129,7 @@
129
129
  width: var(--sui-textbox-height);
130
130
  aspect-ratio: 1/1;
131
131
  }
132
- .password-input :global(button):last-child {
132
+ .password-input :global(button:last-child) {
133
133
  border-radius: 0 4px 4px 0;
134
134
  }
135
135
  .password-input :global(button) :global(.icon) {
@@ -129,10 +129,6 @@
129
129
  width: stretch;
130
130
  min-width: 0;
131
131
  }
132
- .search-bar :global(.icon) {
133
- font-size: calc(var(--sui-textbox-height) * 0.6);
134
- opacity: 0.5;
135
- }
136
132
  .search-bar > span {
137
133
  position: absolute;
138
134
  inset: 0 auto 0 0;
@@ -143,6 +139,10 @@
143
139
  width: var(--sui-button-medium-height);
144
140
  height: var(--sui-button-medium-height);
145
141
  }
142
+ .search-bar :global(.icon) {
143
+ font-size: calc(var(--sui-textbox-height) * 0.6);
144
+ opacity: 0.5;
145
+ }
146
146
  .search-bar > :global(button) {
147
147
  position: absolute;
148
148
  inset: 0 0 auto auto;
@@ -94,8 +94,7 @@
94
94
  min-width: 0;
95
95
  }
96
96
 
97
- textarea,
98
- .clone {
97
+ :is(textarea, .clone) {
99
98
  grid-area: 1/1/2/2;
100
99
  display: block;
101
100
  margin: 0;
@@ -118,19 +117,15 @@ textarea,
118
117
  word-spacing: var(--sui-word-spacing-normal, normal);
119
118
  transition: all 200ms;
120
119
  }
121
- textarea.resizing,
122
- .clone.resizing {
120
+ :is(textarea, .clone).resizing {
123
121
  transition-duration: 0ms;
124
122
  }
125
- textarea:focus,
126
- .clone:focus {
123
+ :is(textarea, .clone):focus {
127
124
  border-color: var(--sui-textbox-border-color-focus, var(--sui-primary-accent-color));
128
125
  color: var(--sui-textbox-foreground-color-focus, var(--sui-textbox-foreground-color));
129
126
  background-color: var(--sui-textbox-background-color-focus, var(--sui-textbox-background-color));
130
127
  }
131
- textarea:disabled, textarea:read-only,
132
- .clone:disabled,
133
- .clone:read-only {
128
+ :is(textarea, .clone):is(:disabled, :read-only) {
134
129
  background-color: var(--sui-disabled-background-color);
135
130
  }
136
131
 
@@ -97,8 +97,7 @@
97
97
  min-width: 0;
98
98
  }
99
99
 
100
- input:-webkit-autofill,
101
- input:-webkit-autofill:focus {
100
+ input:is(:-webkit-autofill, :-webkit-autofill:focus) {
102
101
  transition: background-color 0s 600000s, color 0s 600000s;
103
102
  }
104
103
 
@@ -133,7 +132,7 @@ input:read-only {
133
132
  color: var(--sui-tertiary-foreground-color);
134
133
  border-color: var(--sui-textbox-border-color) !important;
135
134
  }
136
- input:disabled, input:read-only {
135
+ input:is(:disabled, :read-only) {
137
136
  background-color: var(--sui-disabled-background-color);
138
137
  }
139
138
  input[aria-invalid=true] {
@@ -147,7 +146,7 @@ input ~ :global(button) {
147
146
  height: var(--sui-textbox-height);
148
147
  aspect-ratio: 1/1;
149
148
  }
150
- input ~ :global(button):last-child {
149
+ input ~ :global(button:last-child) {
151
150
  border-radius: 0 4px 4px 0;
152
151
  }
153
152
  input ~ :global(button) :global(.icon) {
@@ -171,8 +170,7 @@ input:focus + .label {
171
170
  opacity: 0;
172
171
  }
173
172
 
174
- input::placeholder,
175
- .label {
173
+ :is(input::placeholder, .label) {
176
174
  color: var(--sui-textbox-placeholder-foreground-color, var(--sui-textbox-foreground-color));
177
175
  opacity: var(--sui-textbox-placeholder-opacity, 0.5);
178
176
  font-family: var(--sui-textbox-placeholder-font-family, var(--sui-textbox-font-family));
@@ -167,22 +167,22 @@
167
167
  opacity: 0;
168
168
  }
169
169
  .toast.top-left {
170
- inset: 16px auto auto 16px;
170
+ inset: 0 auto auto 0;
171
171
  }
172
172
  .toast.top-center {
173
- inset: 16px auto auto 50%;
173
+ inset: 0 auto auto 50%;
174
174
  transform: translateX(-50%);
175
175
  }
176
176
  .toast.top-right {
177
- inset: 16px 16px auto auto;
177
+ inset: 0 0 auto auto;
178
178
  }
179
179
  .toast.bottom-left {
180
- inset: auto auto 16px 16px;
180
+ inset: auto auto 0 0;
181
181
  }
182
182
  .toast.bottom-center {
183
- inset: auto auto 16px 50%;
183
+ inset: auto auto 0 50%;
184
184
  transform: translateX(-50%);
185
185
  }
186
186
  .toast.bottom-right {
187
- inset: auto 16px 16px auto;
187
+ inset: auto 0 0 auto;
188
188
  }</style>
@@ -74,8 +74,7 @@
74
74
  flex-direction: column;
75
75
  width: var(--toolbar-size);
76
76
  }
77
- [role=toolbar] :global(button[role="button"][aria-pressed="true"]),
78
- [role=toolbar] :global(button[role="button"][aria-checked="true"]) {
77
+ [role=toolbar] :global(button[role=button]:is([aria-pressed=true], [aria-checked=true])) {
79
78
  background-color: var(--sui-selected-background-color);
80
79
  }
81
80
  [role=toolbar] :global(h2) {
@@ -88,7 +87,7 @@
88
87
  min-width: 0;
89
88
  font-size: var(--sui-font-size-x-large);
90
89
  }
91
- [role=toolbar] :global(h2):first-child {
90
+ [role=toolbar] :global(h2:first-child) {
92
91
  padding-inline-start: 12px;
93
92
  }
94
93
  [role=toolbar] :global(h2) :global(span:not(.sui.truncated-text)) {
@@ -96,11 +95,11 @@
96
95
  font-weight: var(--sui-font-weight-normal, normal);
97
96
  opacity: 0.8;
98
97
  }
99
- [role=toolbar] :global(.divider[aria-orientation="horizontal"]) {
98
+ [role=toolbar] :global(.divider[aria-orientation=horizontal]) {
100
99
  margin: 0 4px;
101
100
  width: calc(100% - 8px);
102
101
  }
103
- [role=toolbar] :global(.divider[aria-orientation="vertical"]) {
102
+ [role=toolbar] :global(.divider[aria-orientation=vertical]) {
104
103
  margin: 4px 0;
105
104
  height: calc(100% - 8px);
106
105
  }
@@ -453,12 +453,7 @@
453
453
  outline-color: var(--sui-primary-accent-color-translucent);
454
454
  z-index: 2;
455
455
  }
456
- :global(h1),
457
- :global(h2),
458
- :global(h3),
459
- :global(h4),
460
- :global(h5),
461
- :global(h6) {
456
+ :global(:is(h1, h2, h3, h4, h5, h6)) {
462
457
  margin: 0;
463
458
  font-weight: var(--sui-font-weight-bold, bold);
464
459
  line-height: var(--sui-line-height-default);
@@ -489,25 +484,20 @@
489
484
  text-decoration: none;
490
485
  text-underline-offset: 2px;
491
486
  }
492
- :global(a:hover), :global(a:focus), :global(a:active) {
487
+ :global(a:is(:hover, :focus, :active)) {
493
488
  text-decoration: underline;
494
489
  }
495
- :global(:root[data-underline-links="true"]) :global(a), :global(:host[data-underline-links="true"]) :global(a) {
490
+ :is(:root, :host)[data-underline-links=true] :global(a) {
496
491
  text-decoration: underline;
497
492
  }
498
- :global(p),
499
- :global(ul),
500
- :global(ol),
501
- :global(dl) {
493
+ :global(:is(p, ul, ol, dl)) {
502
494
  margin: var(--sui-paragraph-margin) 0;
503
495
  line-height: var(--sui-line-height-comfortable);
504
496
  }
505
- :global(ul),
506
- :global(ol) {
497
+ :global(:is(ul, ol)) {
507
498
  padding-inline: 2em;
508
499
  }
509
- :global(code),
510
- :global(pre) {
500
+ :global(:is(code, pre)) {
511
501
  border-radius: 4px;
512
502
  background-color: var(--sui-code-background-color);
513
503
  font-family: var(--sui-font-family-monospace);
@@ -526,8 +516,7 @@
526
516
  :global(table) {
527
517
  border-collapse: collapse;
528
518
  }
529
- :global(th),
530
- :global(td) {
519
+ :global(:is(th, td)) {
531
520
  border: 1px solid var(--sui-textbox-border-color);
532
521
  padding: 8px;
533
522
  }
@@ -536,29 +525,17 @@
536
525
  border-inline-start: 4px solid var(--sui-textbox-border-color);
537
526
  padding-inline-start: 12px;
538
527
  }
539
- :global(.disabled),
540
- :global(.readonly),
541
- :global([aria-disabled=true]),
542
- :global([aria-readonly=true]),
543
- :global([inert]:not(body)) {
528
+ :global(:is(.disabled, .readonly, [aria-disabled=true], [aria-readonly=true], [inert]):not(body)) {
544
529
  cursor: default;
545
530
  pointer-events: none;
546
531
  -webkit-user-select: none;
547
532
  user-select: none;
548
533
  filter: grayscale(1) opacity(0.35);
549
534
  }
550
- :global(.disabled) :global(*),
551
- :global(.readonly) :global(*),
552
- :global([aria-disabled=true]) :global(*),
553
- :global([aria-readonly=true]) :global(*),
554
- :global([inert]:not(body)) :global(*) {
535
+ :global(:is(.disabled, .readonly, [aria-disabled=true], [aria-readonly=true], [inert]):not(body)) :global(*) {
555
536
  filter: grayscale(0) opacity(1);
556
537
  }
557
- :global(.disabled) :global(*),
558
- :global(.readonly) :global(*),
559
- :global([aria-disabled=true]) :global(*),
560
- :global([aria-readonly=true]) :global(*),
561
- :global([inert]) :global(*) {
538
+ :global(:is(.disabled, .readonly, [aria-disabled=true], [aria-readonly=true], [inert])) :global(*) {
562
539
  cursor: default;
563
540
  pointer-events: none;
564
541
  -webkit-user-select: none;
@@ -36,12 +36,15 @@
36
36
  /* eslint-enable prefer-const */
37
37
  } = $props();
38
38
 
39
+ let opening = false;
40
+ let closing = false;
41
+
39
42
  /**
40
43
  * Close the modal.
41
44
  * @param {string} returnValue Return value to be used for `<dialog>`.
42
45
  */
43
46
  export const close = (returnValue) => {
44
- if (!dialog) {
47
+ if (!dialog || !dialog.open || opening || closing) {
45
48
  return;
46
49
  }
47
50
 
@@ -77,10 +80,15 @@
77
80
  * Show the modal.
78
81
  */
79
82
  const openDialog = async () => {
80
- if (!dialog || dialog?.open) {
83
+ if (!dialog || dialog?.open || opening || closing) {
84
+ if (closing) {
85
+ open = false;
86
+ }
87
+
81
88
  return;
82
89
  }
83
90
 
91
+ opening = true;
84
92
  onOpening?.(new CustomEvent('Opening'));
85
93
  showContent = true;
86
94
  dialog.showModal();
@@ -89,18 +97,24 @@
89
97
  setOpenClass = true;
90
98
  await waitForTransition();
91
99
  setActiveClass = true;
100
+ opening = false;
92
101
  };
93
102
 
94
103
  /**
95
104
  * Hide the modal.
96
105
  */
97
106
  const closeDialog = async () => {
98
- if (!dialog || !dialog.open) {
107
+ if (!dialog || !dialog.open || opening || closing) {
108
+ if (opening) {
109
+ open = false;
110
+ }
111
+
99
112
  return;
100
113
  }
101
114
 
102
115
  const { returnValue } = dialog;
103
116
 
117
+ closing = true;
104
118
  onClosing?.(new CustomEvent('Closing'));
105
119
  // Prevent a button behind the `<dialog>` from being clicked erroneously (Svelte bug)
106
120
  document.body.inert = true;
@@ -121,6 +135,7 @@
121
135
 
122
136
  onClose?.(new CustomEvent('Close', { detail: { returnValue } }));
123
137
  dialog.returnValue = '';
138
+ closing = false;
124
139
  };
125
140
 
126
141
  $effect(() => {
@@ -162,8 +177,7 @@
162
177
  lightDismiss &&
163
178
  /** @type {HTMLElement | undefined} */ (target)?.matches('dialog')
164
179
  ) {
165
- dialog.returnValue = 'cancel';
166
- open = false;
180
+ close('cancel');
167
181
  }
168
182
  }}
169
183
  oncancel={(event) => {
@@ -171,8 +185,7 @@
171
185
 
172
186
  // Escape key is pressed
173
187
  if (dialog && escapeDismiss) {
174
- dialog.returnValue = 'cancel';
175
- open = false;
188
+ close('cancel');
176
189
  }
177
190
  }}
178
191
  >
@@ -44,7 +44,7 @@
44
44
  hovered = $bindable(false),
45
45
  content = $bindable(undefined),
46
46
  class: className,
47
- showBackdrop = false,
47
+ showBackdrop = undefined,
48
48
  anchor,
49
49
  position = 'bottom-left',
50
50
  positionBaseElement = undefined,