@sveltia/ui 0.87.0 → 0.87.1
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.
- package/dist/components/listbox/listbox.svelte +0 -5
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu.svelte +0 -5
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/util/app-shell.svelte +2 -0
- package/dist/components/util/popup.svelte +7 -0
- package/dist/services/popup.svelte.js +6 -2
- package/dist/styles/variables.scss +3 -0
- package/package.json +2 -2
|
@@ -106,11 +106,6 @@
|
|
|
106
106
|
font-size: var(--sui-control-font-size);
|
|
107
107
|
line-height: var(--sui-control-line-height);
|
|
108
108
|
}
|
|
109
|
-
@media (pointer: coarse) {
|
|
110
|
-
[role=listbox] {
|
|
111
|
-
gap: 8px 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
109
|
[role=listbox] :global([role=separator]) {
|
|
115
110
|
margin: 4px 0;
|
|
116
111
|
background-color: var(--sui-control-border-color);
|
|
@@ -123,7 +123,11 @@
|
|
|
123
123
|
if (hasItems) {
|
|
124
124
|
event.preventDefault();
|
|
125
125
|
event.stopPropagation();
|
|
126
|
-
|
|
126
|
+
window.clearTimeout(hoverTimer);
|
|
127
|
+
// A pointer click opens rather than toggles, as the hover may have opened the submenu
|
|
128
|
+
// already; on a touch screen, the emulated `mouseenter` comes right before the `click`. A
|
|
129
|
+
// scripted click still toggles it, which is how the keyboard navigation closes it.
|
|
130
|
+
isPopupOpen = event.detail ? true : !isPopupOpen;
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
onclick?.(event);
|
|
@@ -65,11 +65,6 @@
|
|
|
65
65
|
border-radius: var(--sui-menu-border-radius, 4px);
|
|
66
66
|
padding: var(--sui-menu-padding, 4px);
|
|
67
67
|
}
|
|
68
|
-
@media (pointer: coarse) {
|
|
69
|
-
.menu {
|
|
70
|
-
gap: 8px 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
68
|
.menu :global([role=separator]) {
|
|
74
69
|
margin: var(--sui-menu-divider-margin, 4px);
|
|
75
70
|
width: auto;
|
|
@@ -198,6 +198,7 @@
|
|
|
198
198
|
--sui-heading-font-weight: var(--sui-font-weight-bold);
|
|
199
199
|
--sui-heading-line-height: var(--sui-line-height-default);
|
|
200
200
|
--sui-paragraph-margin: 1.75em;
|
|
201
|
+
--sui-menuitem-font-size: 14px;
|
|
201
202
|
--sui-control-small-border-width: 1px;
|
|
202
203
|
--sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);
|
|
203
204
|
--sui-control-small-padding: 0 calc((var(--sui-control-small-height) / 5));
|
|
@@ -275,6 +276,7 @@
|
|
|
275
276
|
@media (pointer: coarse) {
|
|
276
277
|
:global(:root),
|
|
277
278
|
:global(:host) {
|
|
279
|
+
--sui-menuitem-height: 40px;
|
|
278
280
|
--sui-control-small-height: 32px;
|
|
279
281
|
--sui-control-medium-height: 40px;
|
|
280
282
|
--sui-control-large-height: 48px;
|
|
@@ -189,6 +189,7 @@
|
|
|
189
189
|
role="none"
|
|
190
190
|
class="content {className} {contentType}"
|
|
191
191
|
class:touch
|
|
192
|
+
class:nested={!!parentDialogElement}
|
|
192
193
|
style:inset={popupInstance?.style.inset}
|
|
193
194
|
style:z-index={popupInstance?.style.zIndex}
|
|
194
195
|
style:min-width={popupInstance?.style.minWidth}
|
|
@@ -338,4 +339,10 @@
|
|
|
338
339
|
transition-duration: 300ms;
|
|
339
340
|
opacity: 0;
|
|
340
341
|
transform: translateY(-8px);
|
|
342
|
+
}
|
|
343
|
+
.content.nested.menu {
|
|
344
|
+
margin-block: calc(-1 * (var(--sui-menu-border-width, 1px) + var(--sui-menu-padding, 4px)));
|
|
345
|
+
}
|
|
346
|
+
:global(dialog.open) .content.nested.menu {
|
|
347
|
+
transform: none;
|
|
341
348
|
}</style>
|
|
@@ -118,9 +118,13 @@ class Popup {
|
|
|
118
118
|
|
|
119
119
|
this.anchorElement.setAttribute('aria-expanded', 'false');
|
|
120
120
|
|
|
121
|
-
const removeClickListener = on(anchorElement, 'click', () => {
|
|
121
|
+
const removeClickListener = on(anchorElement, 'click', (event) => {
|
|
122
122
|
if (!this.isDisabled && !this.isReadOnly) {
|
|
123
|
-
|
|
123
|
+
// A menu item’s submenu may already have been opened by hovering, which also happens right
|
|
124
|
+
// before a tap on a touch screen, so a pointer click only opens it rather than toggling it
|
|
125
|
+
// closed. A scripted click, which has no `detail`, still toggles it: that’s how the
|
|
126
|
+
// keyboard navigation closes a submenu.
|
|
127
|
+
this.open = event.detail && anchorElement.matches('[role="menuitem"]') ? true : !this.open;
|
|
124
128
|
}
|
|
125
129
|
});
|
|
126
130
|
|
|
@@ -281,6 +281,8 @@
|
|
|
281
281
|
--sui-heading-font-weight: var(--sui-font-weight-bold);
|
|
282
282
|
--sui-heading-line-height: var(--sui-line-height-default);
|
|
283
283
|
--sui-paragraph-margin: 1.75em;
|
|
284
|
+
// Menu
|
|
285
|
+
--sui-menuitem-font-size: 14px;
|
|
284
286
|
// Controls
|
|
285
287
|
--sui-control-small-border-width: 1px;
|
|
286
288
|
--sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);
|
|
@@ -369,6 +371,7 @@
|
|
|
369
371
|
|
|
370
372
|
// Make controls larger on touch devices, e.g. mobile & tablet
|
|
371
373
|
@media (pointer: coarse) {
|
|
374
|
+
--sui-menuitem-height: 40px;
|
|
372
375
|
--sui-control-small-height: 32px;
|
|
373
376
|
--sui-control-medium-height: 40px;
|
|
374
377
|
--sui-control-large-height: 48px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.1",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"eslint-config-airbnb-extended": "^3.3.0",
|
|
82
82
|
"eslint-config-prettier": "^10.1.8",
|
|
83
83
|
"eslint-plugin-import": "^2.32.0",
|
|
84
|
-
"eslint-plugin-jsdoc": "^65.3.
|
|
84
|
+
"eslint-plugin-jsdoc": "^65.3.12",
|
|
85
85
|
"eslint-plugin-package-json": "^1.10.1",
|
|
86
86
|
"eslint-plugin-svelte": "^3.23.1",
|
|
87
87
|
"globals": "^17.13.0",
|