@robert-stackflow/oneui 0.6.60 → 0.6.62
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/CHANGELOG.md +8 -0
- package/components/Control.module.css +0 -5
- package/components/Popover.js +28 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.6.62
|
|
2
|
+
|
|
3
|
+
- Fix popover dismissal in closed shadow roots so select options and trigger clicks work normally.
|
|
4
|
+
|
|
5
|
+
## 0.6.61
|
|
6
|
+
|
|
7
|
+
- Keep editable control typography consistent in narrow windows. Touch input keeps its existing font size.
|
|
8
|
+
|
|
1
9
|
## 0.6.60
|
|
2
10
|
|
|
3
11
|
- 标签页和分段控件以浅底色和短线提示键盘焦点,面板以顶部分隔线提示焦点。高对比度模式保留系统焦点轮廓。
|
|
@@ -85,8 +85,3 @@
|
|
|
85
85
|
.surface:where(input, textarea, :has(input:not([type="hidden"]))) {
|
|
86
86
|
font-size: max(var(--field-font-size), var(--touch-field-font-size, 0px));
|
|
87
87
|
}
|
|
88
|
-
@media (max-width: 600px) {
|
|
89
|
-
.surface:where(input, textarea, :has(input:not([type="hidden"]))) {
|
|
90
|
-
font-size: max(var(--field-font-size), var(--touch-field-font-size, 16px));
|
|
91
|
-
}
|
|
92
|
-
}
|
package/components/Popover.js
CHANGED
|
@@ -160,13 +160,26 @@ function Popover({
|
|
|
160
160
|
subtree: true,
|
|
161
161
|
characterData: true
|
|
162
162
|
});
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
const document = surface.ownerDocument;
|
|
164
|
+
const shadows = /* @__PURE__ */ new Set();
|
|
165
|
+
for (const element of [surface, trigger]) {
|
|
166
|
+
let root2 = element.getRootNode();
|
|
167
|
+
while (root2 instanceof ShadowRoot) {
|
|
168
|
+
shadows.add(root2);
|
|
169
|
+
root2 = root2.host.getRootNode();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const eventRoots = [document, ...shadows];
|
|
173
|
+
const dismissed = /* @__PURE__ */ new WeakSet();
|
|
174
|
+
const dismissOutside = (event) => {
|
|
175
|
+
if (dismissed.has(event)) return;
|
|
176
|
+
const path = event.composedPath();
|
|
177
|
+
if (path.includes(surface) || path.includes(trigger)) return;
|
|
178
|
+
for (const root2 of shadows) {
|
|
179
|
+
if (path.includes(root2.host) && !path.includes(root2)) return;
|
|
180
|
+
}
|
|
181
|
+
dismissed.add(event);
|
|
182
|
+
close.current();
|
|
170
183
|
};
|
|
171
184
|
const key = (event) => {
|
|
172
185
|
if (event.key === "Escape") {
|
|
@@ -178,9 +191,11 @@ function Popover({
|
|
|
178
191
|
trigger.focus();
|
|
179
192
|
}
|
|
180
193
|
};
|
|
181
|
-
|
|
194
|
+
for (const root2 of eventRoots) {
|
|
195
|
+
root2.addEventListener("pointerdown", dismissOutside, true);
|
|
196
|
+
root2.addEventListener("focusin", dismissOutside, true);
|
|
197
|
+
}
|
|
182
198
|
document.addEventListener("keydown", key, true);
|
|
183
|
-
document.addEventListener("focusin", focus, true);
|
|
184
199
|
window.addEventListener("resize", position);
|
|
185
200
|
window.addEventListener("scroll", position, true);
|
|
186
201
|
window.visualViewport?.addEventListener("resize", position);
|
|
@@ -188,9 +203,11 @@ function Popover({
|
|
|
188
203
|
return () => {
|
|
189
204
|
observer.disconnect();
|
|
190
205
|
contentObserver?.disconnect();
|
|
191
|
-
|
|
206
|
+
for (const root2 of eventRoots) {
|
|
207
|
+
root2.removeEventListener("pointerdown", dismissOutside, true);
|
|
208
|
+
root2.removeEventListener("focusin", dismissOutside, true);
|
|
209
|
+
}
|
|
192
210
|
document.removeEventListener("keydown", key, true);
|
|
193
|
-
document.removeEventListener("focusin", focus, true);
|
|
194
211
|
window.removeEventListener("resize", position);
|
|
195
212
|
window.removeEventListener("scroll", position, true);
|
|
196
213
|
window.visualViewport?.removeEventListener("resize", position);
|