@opencode/ui 0.0.0-dev-355 → 0.0.0-dev-360
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode/ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-360",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"dependencies": {
|
|
289
289
|
"@kitlangton/solid-motion": "0.2.2",
|
|
290
290
|
"@kobalte/core": "0.13.13",
|
|
291
|
-
"@opencode/util": "0.0.0-dev-
|
|
291
|
+
"@opencode/util": "0.0.0-dev-360",
|
|
292
292
|
"@pierre/diffs": "1.6.1",
|
|
293
293
|
"@pierre/highlights": "0.2.0",
|
|
294
294
|
"@solid-primitives/event-listener": "2.4.6",
|
|
@@ -182,8 +182,9 @@
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/* A modal Kobalte dialog turns the body's pointer events off and only restores them when its content unmounts, which
|
|
185
|
-
the closing flight above holds back; the page takes clicks again as soon as the close starts.
|
|
186
|
-
body:has(
|
|
185
|
+
the closing flight above holds back; the page takes clicks again as soon as the close starts. The preview marks the
|
|
186
|
+
body itself: a body:has() rule made Chromium restyle the body on every DOM insertion anywhere in the page. */
|
|
187
|
+
body[data-image-preview-closing] {
|
|
187
188
|
pointer-events: auto !important;
|
|
188
189
|
}
|
|
189
190
|
|
|
@@ -405,12 +405,16 @@ export function ImagePreview(props: ImagePreviewProps) {
|
|
|
405
405
|
settle()
|
|
406
406
|
showOrigin()
|
|
407
407
|
giveBack()
|
|
408
|
+
document.body.removeAttribute("data-image-preview-closing")
|
|
408
409
|
})
|
|
409
410
|
|
|
410
411
|
createEffect(
|
|
411
412
|
on(
|
|
412
413
|
() => dialog.isOpen(),
|
|
413
414
|
(open) => {
|
|
415
|
+
// See image-preview.css: the body takes clicks again while the closing flight holds the dialog mounted.
|
|
416
|
+
document.body.toggleAttribute("data-image-preview-closing", !open)
|
|
417
|
+
|
|
414
418
|
if (!open) dismiss()
|
|
415
419
|
},
|
|
416
420
|
{ defer: true },
|
|
@@ -2,7 +2,7 @@ import { Toaster, toast, type ToasterProps } from "solid-sonner"
|
|
|
2
2
|
import { boundToastDescription } from "./description"
|
|
3
3
|
import { isRTL } from "@kobalte/core/i18n"
|
|
4
4
|
import type { ComponentProps, JSX } from "solid-js"
|
|
5
|
-
import { createContext, onCleanup,
|
|
5
|
+
import { createContext, onCleanup, splitProps, useContext } from "solid-js"
|
|
6
6
|
import { Portal } from "solid-js/web"
|
|
7
7
|
import { useI18n } from "../../context/i18n"
|
|
8
8
|
import "../../actions/button/button.css"
|
|
@@ -14,46 +14,26 @@ export interface ToastRegionProps extends ToasterProps {}
|
|
|
14
14
|
function ToastRegion(props: ToastRegionProps) {
|
|
15
15
|
const i18n = useI18n()
|
|
16
16
|
const [local, rest] = splitProps(props, ["class", "className", "style", "toastOptions", "swipeDirections"])
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// The Portal's container holds the toast region whenever it exists. Watching the container, not the whole body,
|
|
19
|
+
// keeps every DOM change elsewhere in the page (each streamed delta, each mounted row) from scanning the document.
|
|
20
|
+
const observe = (container: HTMLDivElement) => {
|
|
18
21
|
const sync = () => {
|
|
19
|
-
|
|
22
|
+
container.querySelectorAll<HTMLElement>(".toast-v2-region .toast-v2").forEach((element) => {
|
|
20
23
|
const hidden = element.dataset.visible === "false"
|
|
21
24
|
element.inert = hidden
|
|
22
25
|
element.tabIndex = hidden ? -1 : 0
|
|
23
26
|
})
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const regions = document.querySelectorAll(".toast-v2-region")
|
|
30
|
-
|
|
31
|
-
if (!regions.length) return
|
|
32
|
-
observer.disconnect()
|
|
33
|
-
regions.forEach((region) => {
|
|
34
|
-
observer.observe(region, {
|
|
35
|
-
subtree: true,
|
|
36
|
-
childList: true,
|
|
37
|
-
attributes: true,
|
|
38
|
-
attributeFilter: ["data-visible"],
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
connected = true
|
|
42
|
-
sync()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const observer = new MutationObserver(() => {
|
|
46
|
-
if (!connected) connect()
|
|
47
|
-
else sync()
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
observer.observe(document.body, { subtree: true, childList: true })
|
|
51
|
-
queueMicrotask(connect)
|
|
29
|
+
const observer = new MutationObserver(sync)
|
|
30
|
+
observer.observe(container, { subtree: true, childList: true, attributes: true, attributeFilter: ["data-visible"] })
|
|
31
|
+
sync()
|
|
52
32
|
onCleanup(() => observer.disconnect())
|
|
53
|
-
}
|
|
33
|
+
}
|
|
54
34
|
|
|
55
35
|
return (
|
|
56
|
-
<Portal>
|
|
36
|
+
<Portal ref={observe}>
|
|
57
37
|
<Toaster
|
|
58
38
|
position={isRTL(i18n.locale()) ? "bottom-left" : "bottom-right"}
|
|
59
39
|
offset={isRTL(i18n.locale()) ? { left: 32, bottom: 48 } : { right: 32, bottom: 48 }}
|