@stnd/ui 0.7.2 → 0.8.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.
- package/AlertDialog.svelte +17 -0
- package/CHANGELOG.md +17 -0
- package/TableOfContents.astro +12 -16
- package/package.json +2 -2
package/AlertDialog.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { tick } from "svelte";
|
|
2
3
|
/**
|
|
3
4
|
* @component AlertDialog
|
|
4
5
|
* @description A native `<dialog>`-based confirmation modal. Used
|
|
@@ -26,12 +27,28 @@
|
|
|
26
27
|
} = $props();
|
|
27
28
|
|
|
28
29
|
let dialog = $state();
|
|
30
|
+
/** @type {Element | null} */
|
|
31
|
+
let opener = null;
|
|
29
32
|
|
|
30
33
|
$effect(() => {
|
|
31
34
|
if (open && dialog && !dialog.open) {
|
|
35
|
+
opener = document.activeElement;
|
|
32
36
|
dialog.showModal();
|
|
33
37
|
} else if (!open && dialog && dialog.open) {
|
|
34
38
|
dialog.close();
|
|
39
|
+
// Hand focus back. A closed <dialog> is display:none, but the button
|
|
40
|
+
// the user just pressed stays `document.activeElement` — and this
|
|
41
|
+
// dialog swallows keydown (below), so until something else took focus
|
|
42
|
+
// every key, Escape and the app's shortcuts included, went to a hidden
|
|
43
|
+
// button and died there. `Dialog` restores focus; this one did not.
|
|
44
|
+
const back = opener;
|
|
45
|
+
opener = null;
|
|
46
|
+
tick().then(() => {
|
|
47
|
+
if (back?.isConnected) /** @type {HTMLElement} */ (back).focus?.();
|
|
48
|
+
// The opener may be disabled by now (a busy "Clear" button) and refuse
|
|
49
|
+
// focus; never leave it on the dialog we just closed.
|
|
50
|
+
if (dialog?.contains(document.activeElement)) /** @type {HTMLElement} */ (document.activeElement).blur();
|
|
51
|
+
});
|
|
35
52
|
}
|
|
36
53
|
});
|
|
37
54
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @stnd/ui
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Auto-bumped @stnd/ui due to modified code.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @stnd/icon@0.4.0
|
|
13
|
+
|
|
14
|
+
## 0.7.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Auto-bumped @stnd/ui due to modified code.
|
|
19
|
+
|
|
3
20
|
## 0.7.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/TableOfContents.astro
CHANGED
|
@@ -104,12 +104,12 @@ const tocHeadings = (headings || [])
|
|
|
104
104
|
border: 1px solid transparent;
|
|
105
105
|
opacity: 0.45;
|
|
106
106
|
transition:
|
|
107
|
-
opacity
|
|
108
|
-
background
|
|
109
|
-
border-color
|
|
110
|
-
box-shadow
|
|
111
|
-
backdrop-filter
|
|
112
|
-
padding
|
|
107
|
+
opacity var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1),
|
|
108
|
+
background var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1),
|
|
109
|
+
border-color var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1),
|
|
110
|
+
box-shadow var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1),
|
|
111
|
+
backdrop-filter var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1),
|
|
112
|
+
padding var(--duration-fast) cubic-bezier(0.16, 1, 0.3, 1);
|
|
113
113
|
user-select: none;
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -121,13 +121,8 @@ const tocHeadings = (headings || [])
|
|
|
121
121
|
.stnd-toc:hover,
|
|
122
122
|
.stnd-toc:focus-within {
|
|
123
123
|
opacity: 1;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var(--color-surface-light-1, var(--color-background)) 92%,
|
|
127
|
-
transparent
|
|
128
|
-
);
|
|
129
|
-
backdrop-filter: var(--filter-glass, blur(20px)) saturate(160%);
|
|
130
|
-
-webkit-backdrop-filter: var(--filter-glass, blur(20px)) saturate(160%);
|
|
124
|
+
backdrop-filter: var(--filter-glass);
|
|
125
|
+
-webkit-backdrop-filter: var(--filter-glass);
|
|
131
126
|
border-color: var(--color-border);
|
|
132
127
|
box-shadow: var(--shadow-xl, var(--shadow-raised));
|
|
133
128
|
padding: 0.75rem 1rem 0.85rem 1.25rem;
|
|
@@ -135,6 +130,7 @@ const tocHeadings = (headings || [])
|
|
|
135
130
|
|
|
136
131
|
/* Architectural vertical spine guide */
|
|
137
132
|
.toc-spine {
|
|
133
|
+
display: none;
|
|
138
134
|
position: absolute;
|
|
139
135
|
right: 14px;
|
|
140
136
|
top: 0.75rem;
|
|
@@ -195,7 +191,7 @@ const tocHeadings = (headings || [])
|
|
|
195
191
|
.toc-list {
|
|
196
192
|
display: flex;
|
|
197
193
|
flex-direction: column;
|
|
198
|
-
gap:
|
|
194
|
+
gap: 0;
|
|
199
195
|
position: relative;
|
|
200
196
|
z-index: 2;
|
|
201
197
|
max-height: calc(75vh - 2rem);
|
|
@@ -218,9 +214,9 @@ const tocHeadings = (headings || [])
|
|
|
218
214
|
display: flex;
|
|
219
215
|
align-items: center;
|
|
220
216
|
justify-content: flex-end;
|
|
221
|
-
gap:
|
|
217
|
+
gap: 6px;
|
|
222
218
|
text-decoration: none;
|
|
223
|
-
padding: 3px
|
|
219
|
+
padding: 3px 0px 3px 6px;
|
|
224
220
|
border-radius: var(--radius-sm, 4px);
|
|
225
221
|
cursor: pointer;
|
|
226
222
|
transition: background 0.15s ease;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stnd/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"svelte": "./Combobox.svelte",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"wrangler": "^4.129.0",
|
|
33
|
-
"@stnd/icon": "0.
|
|
33
|
+
"@stnd/icon": "0.4.0",
|
|
34
34
|
"@stnd/store": "0.5.1",
|
|
35
35
|
"@stnd/utils": "0.6.1"
|
|
36
36
|
},
|